Copy link to clipboard
Copied
My goal is to change a lot of PDF file names (in windows).
Now the files are like: April, 1 2009 Wednesday.
I would like to change that to 2009_04_01_04042009. That is, in the format Year_Month_Day_DayMonthYear.
Does anyone know how to do this? That would be incredibly helpful!
Copy link to clipboard
Copied
Hello Martin, Sorry for have delayed on this one...
well, just create a txt file and name it as you like but using a .bat extension
then place it inside the foler where the file are named as you described above
copy paste the code below, and once saved, double clik on the bat file... the DOS will handle the magic
be aware to copy saved the old file, just in case of an unexpected error...
let me know if that fits your needs
have a pleasant day
birnou
@ECHO off
SETLOCAL EnableDelayedExpansion
SET map[January]=01
SET map[February]=02
SET map[March]=03
SET map[April]=04
SET map[May]=05
SET map[June]=06
SET map[July]=07
SET map[August]=08
SET map[September]=09
SET map[October]=10
SET map[November]=11
SET map[December]=12
FOR %%a in (*.pdf) do (
SET OLD_FILE_NAME=%%~na
FOR /F "tokens=1,2,3 delims=,. " %%P in ("%%a") do (
SET M=!map[%%~nP]!
SET D=000000%%~nQ
SET Y=%%~nR
SET NEW_FILE_NAME=!Y!_!M!_!D:~-2!_!D:~-2!!M!!Y!
RENAME "!OLD_FILE_NAME!.pdf" "!NEW_FILE_NAME!.pdf"
)
)
ECHO DONE
PAUSE
Copy link to clipboard
Copied
what's about a command prompt...
are the files already created... or will you run a batch process?
Copy link to clipboard
Copied
Right now, the files are like this (there are many more), so they are already created:

A command prompt could possibly work but I have very little experience in working with them. Nevertheless, the very limit number of variables (days, months, years) gives me the idea that it would not be too complex to construct such a code.
Copy link to clipboard
Copied
are you in a hurry... I'm pretty busy right now, but , one of these days, I could write such a .bat file...
Copy link to clipboard
Copied
In Adobe Acrobat you can't rename files. You can save copy of the PDF with a new name.
Copy link to clipboard
Copied
yep, but martin will have to manually repeat hundreds time this operation, without avoiding the fact of calculating by head what should be the new name depending on the date algorythm...
that's why I supose that he looks for a batching process...
Copy link to clipboard
Copied
I understand this, but Adobe Acrobat can't rename files.
Copy link to clipboard
Copied
Hello Martin, Sorry for have delayed on this one...
well, just create a txt file and name it as you like but using a .bat extension
then place it inside the foler where the file are named as you described above
copy paste the code below, and once saved, double clik on the bat file... the DOS will handle the magic
be aware to copy saved the old file, just in case of an unexpected error...
let me know if that fits your needs
have a pleasant day
birnou
@ECHO off
SETLOCAL EnableDelayedExpansion
SET map[January]=01
SET map[February]=02
SET map[March]=03
SET map[April]=04
SET map[May]=05
SET map[June]=06
SET map[July]=07
SET map[August]=08
SET map[September]=09
SET map[October]=10
SET map[November]=11
SET map[December]=12
FOR %%a in (*.pdf) do (
SET OLD_FILE_NAME=%%~na
FOR /F "tokens=1,2,3 delims=,. " %%P in ("%%a") do (
SET M=!map[%%~nP]!
SET D=000000%%~nQ
SET Y=%%~nR
SET NEW_FILE_NAME=!Y!_!M!_!D:~-2!_!D:~-2!!M!!Y!
RENAME "!OLD_FILE_NAME!.pdf" "!NEW_FILE_NAME!.pdf"
)
)
ECHO DONE
PAUSE
Find more inspiration, events, and resources on the new Adobe Community
Explore Now