Question : delete file and copy new file

Hey all...

I am trying to run a batch script from a thumb drive that deletes a folder on the C:\ drive and copies a folder from the thumb drive to the c:\

It works fine when I am copying a folder with only a few files, so I guess I need it to wait for the folder to finish copying the files before exit.

here is what I have... I am using three .bat files

deleteold.bat to delete the folder on the c drive

code:
rd /s /q "C:\My Folder"
exit

copynew.bat to copy the new folder to the c drive

code:
xCOPY ..\My Folder\My Folder C:\My Folder\ /e /i
exit

and i am running them thru a combine.bat

code:
start /wait deleteold.bat
echo OLD FILES DELETED

start /wait copynew.bat

exit

I am new to batch files so I am trying to keep it simple at first

the folder I am deleteing contains about 500MB
the folder I am copying contains about 450MB

How do I get the batch file to finish deleting old folder before it starts copying new folder    &
How do I get batch file copying the new folder to wait until it finishes  the copying before exiting

Answer : delete file and copy new file

:deleteold.bat
rd /s /q "C:\My Folder"


:copynew.bat
xcopy "..\My Folder\My Folder" "C:\My Folder\"  /e /i


:combine.bat
call deleteold.bat
echo OLD FILES DELETED
call copynew.bat
exit
Random Solutions  
 
programming4us programming4us