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.
You can automatically move files from one folder to another by using a script that uses Robocopy, a command-line utility which comes with Windows 10. To automated file transfer, you need to use Robocopy script, add frequency in days, source and destination folder paths.
Highlight the files you want to move. Press the keyboard shortcut Command + C . Move to the location you want to move the files and press Option + Command + V to move the files.
Create a file called MoveFiles.bat with the syntax
move c:\Sourcefoldernam\*.* e:\destinationFolder
then schedule a task to run that MoveFiles.bat every 10 hours.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With