Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Rename PDF files in specific date format

New Here ,
Oct 25, 2017 Oct 25, 2017

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!

TOPICS
Edit and convert PDFs
3.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Oct 29, 2017 Oct 29, 2017
LATEST

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

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2017 Oct 25, 2017

what's about a command prompt...

are the files already created... or will you run a batch process?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 25, 2017 Oct 25, 2017

Right now, the files are like this (there are many more), so they are already created:

PDFs.png

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2017 Oct 25, 2017

are you in a hurry... I'm pretty busy right now, but , one of these days, I could write such a .bat file...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2017 Oct 25, 2017

In Adobe Acrobat you can't rename files. You can save copy of the PDF with a new name.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2017 Oct 25, 2017

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...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 26, 2017 Oct 26, 2017

I understand this, but Adobe Acrobat can't rename files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2017 Oct 29, 2017
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines