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

Batch rename a alrge number of pdf files

Explorer ,
Apr 23, 2022 Apr 23, 2022

Hello,

I am aware that this issue has already been discussed previously but I could not find a solution for my problem.

I have created a larger number of ~4000 pdf files by scanning paper documents. I batch converted them to OCR text documents (the quality of the scans was quite good). Now I would like to rename the files based on the content of the individual files. Of course it would be very nice if this task could be automated.

 

All the files have a similar structure and they contain a text line on the first page:

<standard text> <family name>, <given name(s)>, * <date of birth> <other text>

I would like to rename the files (or created copies of them)  such that the new files / copies have the file names <family name>, <given name(s)>.pdf.

 

<standard text> is always the same text (in two variants - for male/female).

 

Is it possible to use a script to batch rename this large number of files? Unfortunately I  myself have no experinec with scripts and have never created one ... I would be very grateful for any help or suggestions.

 

(I am using Mac OS.)

 

 

 

TOPICS
Edit and convert PDFs
3.4K
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 ,
Apr 23, 2022 Apr 23, 2022
LATEST

This is not a trivial scripting task, and it needs to be developed to your specific needs, so you're unlikely to find some generic solution you could just plug&play and make it work for you. It has to be developed by a professional.

 

I've developed many similar tools in the past for my clients so if you're interested in hiring someone to do it for you, feel free to contact me privately to discuss it further.

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
LEGEND ,
Apr 23, 2022 Apr 23, 2022

Acrobat has no facilities to do this at all, but it could be done with scripting. Take great care trying to do things with shell scripts; the slightest mistake can remove all the files in a folder, or leave a system completely unbootable! At least work on a COPY of the folder, expect to run the scipt over and over until it works. There is however, no difficulty for the script in doing this, however, it can't be done with just one line. If I was working on this, I would write an app or script to create a large number of separate rename commands (mv) in a file. Then examine the file produced with great care before attempting to run it. Beware especially of spaces in the file names. This isn't a job for the faint hearted!

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
Explorer ,
Apr 23, 2022 Apr 23, 2022

Thank you very much for your answer. Of course I would only work with file copies, not with the original files. I have already made backups. I certainly don't want to risk an unbootable system.

The problem is that I do not have any experience in writing such scripts. I thought that this task (renaming a file from extracted content) would not be too eccentric and perhaps there are already some example scripts available that could be used in an adapted and modified form. Do you have any suggestions?

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 ,
Apr 23, 2022 Apr 23, 2022

There are two main issues (assuming the text is recognizable) with doing it using a script in Acrobat:

1. A script can't rename files. It can only save a copy under a new name. But that's easily solved if you save the file in a different folder, and then delete the originals manually and copy over the new files into the original folder.

2. A script can't include a comma in the file-name, due to some unknown security issue. A workaround for that could be to use a different character and then use a generic file renaming app to change that character to a comma.

In addition, processing 4000 files will likely prove to be too much for Acrobat to be able to handle in a single process, so you will need to do it in batches.

The solution to all of these issues is to do it using a stand-alone (possible command-line) tool, running outside of Acrobat. Such a tool could do all of the above, and could process many more files than Acrobat could.

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
Explorer ,
Apr 23, 2022 Apr 23, 2022

Thank you for your answer. The two issues (making a copy instead of renaming and no comma allowed) are certainly no major obstacles and could be solved as you suggested.

However, my main problem is that I have never written a script and need some advice how to do this or where to find a script that could be modified and adapted to do this specific task. I hoped that this problem (renaming a large number of pdf files from their content) has already been addressed by someone else here ...

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 ,
Apr 23, 2022 Apr 23, 2022
LATEST

This is not a trivial scripting task, and it needs to be developed to your specific needs, so you're unlikely to find some generic solution you could just plug&play and make it work for you. It has to be developed by a professional.

 

I've developed many similar tools in the past for my clients so if you're interested in hiring someone to do it for you, feel free to contact me privately to discuss it further.

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