Im trying to copy files from one drive to another using a batch file, Which works! but we keep Changing file names on our main file which creates addition copys with diffrent names everytime its run. I dont want to delete the Copy file entirely bacause of the length of time the copy takes just to copy. I would like to Compare the 2 files and delete the files that are no longer on the main drive here is the test that im working on. Thanks for any help you can give me.
@echo cls If not exist "C:\Users\Jeremy\Desktop\Test Main\*.*" "Del "C:\Users\Jeremy\Desktop\Test Clone\*.*" xcopy "C:\Users\Jeremy\Desktop\Test Main\*.*" "C:\Users\Jeremy\Desktop\Test Clone\*.*" /D /C /E /S /I /Y /V /H /R /F /d:01-01-1998 pause :abort echo You pressed CTRL+C to end the copy operation. goto exit
you might want to look into
robocopy, specifically with the
/mir switch, which mirrors (copy all new files and delete all no longer existing files) the source folder to the target.