Copying all files in one folder from another folder when file exists

Experts,

I have folders on my "C" drive in a folder called "Requests".

ie. C drive Path /Requests/Username/Request_No

I would like to copy all files in that folder to a network drive to a folder with the same Username/Request_No
ie Network Drive Path/Username/Request_No (If file exists)

Can someone tell me the script in Windows to do this.



You can use robocopy to do this.

Open notepad copy the one line script below and Save the script as cmd

robocopy /MIR /E /Z /LOG:C:Robocopylog.txt /TEE /R:2 /W:0

Where
/MIR Mirrors a directory tree
/E Copies all subdirectories including empty ones.
/Z Copies files in restartable mode (that is, restarts the copy process from the point of failure).
/LOG: Generates a log file name robocopylog.txt
/TEE Logs to file as well as to the console
/R:0 Number of times to retry copying a locked file
/W:0 Time in between retry attempts

see my post at the link below.

http://www.giveandtake638.com/it-system-administration/use-robocopy-movemigrate-foldersdirectoryies-one-server-another-another-location

You can then schedule the script to run maybe 1mins or depending on when you want to be checking the source using schedule task.

Regards



You can use robocopy to do this.

Open notepad copy the one line script below and Save the script as cmd

robocopy /MIR /E /Z /LOG:C:Robocopylog.txt /TEE /R:2 /W:0

Where
/MIR Mirrors a directory tree
/E Copies all subdirectories including empty ones.
/Z Copies files in restartable mode (that is, restarts the copy process from the point of failure).
/LOG: Generates a log file name robocopylog.txt
/TEE Logs to file as well as to the console
/R:0 Number of times to retry copying a locked file
/W:0 Time in between retry attempts

see my post at the link below.

http://www.giveandtake638.com/it-system-administration/use-robocopy-movemigrate-foldersdirectoryies-one-server-another-another-location

You can then schedule the script to run maybe 1mins or depending on when you want to be checking the source using schedule task.

Regards



Will robicop you copy the files from my directory where they exist and leave whatever else is in the directory alone



Yes, but it will replicate whatever in the source directory to the destination directory in the same tree format using /MIR





Share this

Related Posts

There was an error in this gadget