I need to move files from one directory to another in windows, and I need to write this in a batch script.
We have written a SQL job where backup files will be created every 4 hours on the D:
drive and last 4 backup files will be saved and others will be deleted.
I need to write a batch script to move these files from the D:
drive to the E:
drive every 10 hours.
Can anyone help me to write this script.
This is exactly how it worked for me. For some reason the above code failed.
This one runs a check every 3 minutes for any files in there and auto moves it to the destination folder. If you need to be prompted for conflicts then change the /y to /-y
Create a file called MoveFiles.bat with the syntax
then schedule a task to run that MoveFiles.bat every 10 hours.
You can try this:
:backup move C:\FilesToBeBackedUp\*.* E:\BackupPlace\ timeout 36000 goto backup
If that doesn't work try to replace "timeout" with sleep. Ik this post is over a year old, just helping anyone with the same problem.