1.

Solve : Transfer a file with current date?

Answer»

Hi,

I would like to inform that I am using two machines with save data on regular basis. I want to transfer
the latest file of each day to a new directory of the same computer. Could SOMEONE please help me
that how can I automatically copy the new file to another directory. I am novice in using batch file so if please anybody provide a batch file for this purpose I will be highly thankful.  You could easily use something like this:

CODE: [Select]ECHO OFF
TITLE Organizer 0.1b
SET PRE=%DATE:/=-% && SET TODAY=%PRE:~4,10%
SET DIR=%CD%
REM Replace *FILENAME.* with whatever is appropriate. Try to keep you selection as small as possible.
REM Don't use too MANY wildcards. Something like " *.txt, or %TODAY%*.* can work just fine.
XCOPY %DIR%\*FILENAME.* %DIR%\%TODAY%\. /F /I
REM This will search it's home directory, and find all files that were modified or created today.
REM Then, it will copy them to a folder with today's date as the name.

I tested it on a directory with 12 files. 6 were created today, and the others are older.

If you want this to RUN automatically each night, that is also possible. But as is, you can just set it up as needed, and double-click it nightly.



Discussion

No Comment Found