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!

  • Have you tried something already that fails or are you looking for someone to write the script for you? – J E Carter II Oct 22 '15 at 17:25
  • 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 How to Ask. However, I'd advise ROBOCOPY.exe. – JosefZ Oct 22 '15 at 19:15

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.