0

I am trying to write a command prompt in changing file names for a monthly report I run and am automating.

I have the export file as "Export.xlsx", and I want to change it to 02 2018.xlsx, 03 2018.xlsx, etc, without having to go into the code each month and change the number. Is there a way that Windows can sense what numbers are in the folder already and add 1 number to the file name? Here is the current lines I have. If the arrangement of numbers needs to change for this to be possible, that is just fine.

rename "File Path\Projects_Log.csv" "03 18 Projects_Log.csv"

1
  • (1) Do you want it to use the current month, or do you want to find the highest existing file and add one? (2) Do you want “MM YYYY” or “MM YY”? (3) What’s the relationship between Export.xlsx and File Path\Projects_Log.csv? Please do not respond in comments; edit your question to make it clearer and more complete. Commented Mar 21, 2018 at 22:30

1 Answer 1

0

To rename the files with date time, try this command:

ren e:\test2\test.txt  test_%date:~10,4%%date:~7,2%%date:~4,2%_%time:~0,2%%time:~3,2%.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .