Renaming pdf files in bulk using automator code - doesn't pick up line 1 / file 1

I've used the code and method referenced in this article Batch rename Files with Automater and a .… - Apple Community

and got great results, excepting the first numbered file. All are pdf's that were split using acrobat and are now name filename_part1, filename_part2, and so on.

Can't figure out why the code is skipping the first file or line in the titles.csv?

Any ideas?

Here is my titles.csv shown in excel view:



MacBook Pro (M2 Pro, 2023)

Posted on May 24, 2023 7:11 PM

Reply
Question marked as Top-ranking reply

Posted on May 25, 2023 6:37 AM

That Automator Zsh shell solution expects a comma as a CSV column delimiter and splits the row (e.g. line) into old_name and new_name counterparts based on that delimiter. It is not designed to process a CSV with a header row, and will deal with double-quoted row entries by removing those double-quotes.


What is unique about that first row of the CSV that is not present in the subsequent rows?

5 replies
Question marked as Top-ranking reply

May 25, 2023 6:37 AM in response to czc7tr

That Automator Zsh shell solution expects a comma as a CSV column delimiter and splits the row (e.g. line) into old_name and new_name counterparts based on that delimiter. It is not designed to process a CSV with a header row, and will deal with double-quoted row entries by removing those double-quotes.


What is unique about that first row of the CSV that is not present in the subsequent rows?

May 30, 2023 5:14 PM in response to VikingOSX

I don't see anything unique - did not use a header row (sorry post removed pic of my code but here is the exact content of my titles.csv file:


MRP Annual Incentive Plan_GMPM AURSLC_Part1.pdf,BARBIAN_2023 MRP Incentive Plan_JENSEN.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part2.pdf,CHAMBERS_2023 MRP Incentive Plan_ALLISON.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part3.pdf,CHAMBERS_2023 MRP Incentive Plan_CHARITAN.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part4.pdf,SHAPIRO_2023 MRP Incentive Plan_CHAMBERS.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part5.pdf,Swisher_2023 MRP Incentive Plan_SHAPIRO.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part6.pdf,CARO_2023 MRP Incentive Plan_CALLAHAN.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part7.pdf,CARO_2023 MRP Incentive Plan_STEWART.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part8.pdf,LARSON_2023 MRP Incentive Plan_PETRELLA.pdf

MRP Annual Incentive Plan_GMPM AURSLC_Part9.pdf,LIPSCOMB_2023 MRP Incentive Plan_CARO.pdf

May 31, 2023 5:34 AM in response to czc7tr

I created a new Automator application using the instructions and code from the Automator Zsh shell solution link from above, and the only change I made was the name of the CSV file in that selected folder containing the PDFs. I then recreated the source PDF filenames in that folder per your May 30 CSV example, and when I run the Automator application, I got the following dialog:




So, all nine files in the CSV were processed and renamed.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Renaming pdf files in bulk using automator code - doesn't pick up line 1 / file 1

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.