Batch file to copy new files from source to destination

0

I need a batch file that will copy text files that are generated daily and dropped into the E:\BAP Reports\Director Reports folder to our P:. Since nothing ever gets deleted from the Director Reports folder, I need a script that will copy ONLY the newest text files daily. Please help!

Peach

Posted 2015-10-22T16:48:16.197

Reputation: 1

Have you tried something already that fails or are you looking for someone to write the script for you? – J E Carter II – 2015-10-22T17:25:08.317

Welcome to Super User. We are not a script writing service. We expect users to tell us what they have tried so far (including any scripts they are using) and where they're stuck so that we can help with specific problems. Questions that only ask for scripts are too broad and are likely to be put on hold or closed. Please read [ask]. However, I'd advise ROBOCOPY.exe.

– JosefZ – 2015-10-22T19:15:08.803

Answers

0

Robocopy "E:\BAP Reports\Director Reports folder" "P:." /E /XO /L Test with above. Make sure you include the /L part. This will test the command out and not do anything beside list files and a RoboCopy report.

The gist of the command is to copy only new files. /E Allows coping in all sub folders of the director folder, if there are any, you didn't say.

You also didn't say what the destination folder is P is pretty vague. The reason I mention this is because RoboCopy copies NTFS permissions to, which is an important aspect in Windows File security and to organizations.

reference on RoboCopy should be used if you run into issues,

InDepth More then Anybody would want to know http://theether.net/download/Microsoft/Utilities/robocopy.pdf

Short Laymen Reference http://ss64.com/nt/robocopy.html But AGAIN if you use /L and test before executing you should be fine.

Also try the /Z And /ZB if you run problems.

Noshad Chaudhry

Posted 2015-10-22T16:48:16.197

Reputation: 138