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.
moriniaAdvanced Analytics AnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
You can use robocopy to do this.

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

robocopy <Source> <Destination>/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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
moriniaAdvanced Analytics AnalystAuthor Commented:
Will robicop you copy the files from my directory where they exist and leave whatever else is in the directory alone
Emmanuel AdebayoGlobal Windows Infrastructure Engineer - ConsultantCommented:
Yes, but it will replicate whatever in the source directory to the destination directory in the same tree format using /MIR
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.