Click here for important information about

Solved add date to all files name in a folder

November 3, 2011 at 09:21:27
Specs: Windows 7
Hi all,

I need use batch file to add date to all files name in a folder. Now the problem is that my batch can only add the date to the file with the single word in the file name. Such as if the file name is "report.xls" then could change to report1 October 2011.xls. But if the file name has more than one word, it doesn't work. Such as "report for monthly summary.xls", and all my files have names like that. Can batch file do something like that? Thank you for any suggestions/helps!!

here is my code, I have made it as simple as possible:
@Echo Off

set A=October
set C=2011

set All=%A%-%C%

@For %%a in ("*.xls") do (
copy %%a "%%~na %All%.xls"


See More: add date to all files name in a folder

November 4, 2011 at 02:13:36
✔ Best Answer
Filenames with spaces should be enclosed in double quotes.

In the Copy command line enclose %%a in "" e.g. "%%a"

Please come back & tell us if your problem is resolved.

Report •

November 4, 2011 at 05:28:00

Thank you so much!!!
It is working perfectly.

Report •
Related Solutions

Ask Question