Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Rename 300+ PDF files within Directory

cp2019
7 - Meteor

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!

5 REPLIES 5
Luke_C
17 - Castor

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

 

lukecornetta_0-1615481454439.png

 

cp2019
7 - Meteor

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!

Luke_C
17 - Castor

@cp2019 

 

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),"")

cp2019
7 - Meteor

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

trettelap
8 - Asteroid

Found this when googling not even knowing if this was possible with Alteryx. Awesome use case!

Labels