1.

Solve : Copy new files?

Answer»

Hi everyone,

I need to copy newly created files from a FOLDER to a folder on another server. I am planning to schedule this as a job in a batch file to RUN everyday during night. The problem is how do i findout when the file is created. I need to copy only new files that are created on the day the script is running.

Any ideas any help, MUCH appreciated..

Thanks a lot.Without an OS I can only guess. This may work on your machine:

CODE: [Select]@ECHO off
for /f "tokens=1-2" %%a in ('date /t') do set datem=%%b
for /f "skip=5 tokens=1-5" %%i in ('dir /tc /a:-d yourdirectorygoeshere') do (
if %%i==%datem% copy yourdirectorygoeshere\%%m destinationfolder
)

Change yourdirectorygoeshere and destinationfolder to something appropriate. All bets are off if this runs after midnight :-/



Discussion

No Comment Found