Computer Hope
Microsoft => Microsoft Windows => Windows XP => Topic started by: dwiseman3 on May 20, 2009, 12:47:45 PM
-
I want to write a batch file to copy a file from one server to another. The filename changes everyday and includes today's date. How do I incorporate the changing filename into the script?
-
Is the date the only thing that changes in the file name?
-
yes, only the date changes
-
Sounds like Robocopy (http://en.wikipedia.org/wiki/Robocopy) is the boy for you.
-
You can try this.....
For /f "tokens=2-4 delims=/ " %%a in ('date/t') do (
Set month=%%a
Set day=%%b
Set year=%%c
)
REN D:\Temp\your_file.txt your_file%year%%month%%day%.TXT
should give you a file called your_file20090527.txt