I have 300+ PDF files within a directory that I need to rename.
They are all named as people's names ("John Smith.pdf")
What is the easiest way to dynamically rename all of the PDF files to be named as "Smith, John.pdf"?
Thank you!
Solved! Go to Solution.
Hi @cp2019
You can use the formula tool to dynamically create a command that the run command tool can execute. See attached workflow that should work for your use case, you just need to update the directory tool. It assumes that the file names only contain first and last names, and I'd definitely recommend making a copy before you run it just in case 🙂
Let me know if you have any questions
Hey this works great, thank you so much!
Just one quick tweak if possible...
Technically, a few people have their middle name displayed (ie - John Thomas Smith), can there be logic that accounts for these few instances and would make it "Smith, John Thomas"
Thanks so much!
Update the new file name formula to the below, that should work. Please accept the solution if you're all set!
getword(Replace([FileName], ".pdf", ""),CountWords([FileName])-1) + ", " +
replace([FileName]," " + getword(Replace([FileName], ".pdf", ""),CountWords([FileName])-1),"")
This looks great, thank you so much. Definitely a model that can be used easily for other use cases on my end too and built upon.
I will accept as a solution
Found this when googling not even knowing if this was possible with Alteryx. Awesome use case!