Windows script package for moving files

I need to move files from one directory to another in windows, and I need to write this in a batch script.

We wrote an SQL task in which backup files will be created every 4 hours on the D: drive, and the last 4 backup files will be saved, and the others will be deleted.

I need to write a script package to move these files from drive D: to drive E: every 10 hours.

Can anyone help me write this script.

+8
source share
4 answers

Create a file called MoveFiles.bat with the syntax

 move c:\Sourcefoldernam\*.* e:\destinationFolder 

then schedule a task to run this MoveFiles.bat every 10 hours.

+7
source

You can try the following:

:backup move C:\FilesToBeBackedUp\*.* E:\BackupPlace\ timeout 36000 goto backup

If this does not work, try replacing the timeout with sleep. Ik this post is older than a year, just helping someone with the same problem.

+5
source

This is exactly how it worked for me. For some reason, the above code failed.

This file starts a scan every 3 minutes for any files and automatically moves them to the destination folder. If you need to cause conflicts, change / y to / -y

 :backup move /y "D:\Dropbox\Dropbox\Camera Uploads\*.*" "D:\Archive\Camera Uploads\" timeout 360 goto backup 
+3
source
 move c:\Sourcefoldernam\*.* e:\destinationFolder 

^ I didn’t succeed for some reason

But when I tried using quotes, it unexpectedly worked:

 move "c:\Sourcefoldernam\*.*" "e:\destinationFolder" 

I think because in my directory there were spaces in one of the folders. So if this does not work for you, try with quotes!

+1
source

All Articles