Alteryx Designer Desktop Discussions

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

PDF File Name Change

JamesJL
7 - Meteor

Hi all,

I'm having some issues creating a workflow to rename pdf files. I have 75 pdf files but they're all named differently. My goal is to rename them for example:

abc - xyz

I only want abc. I tried using formulas but its not working. Fortunately all the files have a dash (-) and I wanted to have it delete every letter after including the first dash.

 

I tried the following: New Field: Filenameout 

 Regexreplace([filename], '(.)\s-.(.pdf)', '$1$2')

 

Another new field: Command

[directory] + "\rename " + [filename] + " " + filenameout

 

I tried the command tool but I'm not sure why it's not working. The PDFs are in a shared folder.

 

Any suggestions?

4 REPLIES 4
Felipe_Ribeir0
16 - Nebula

Hi @JamesJL 

 

You can use this macro to rename files: https://community.alteryx.com/t5/Community-Gallery/Rename-files/ta-p/998942

 

Felipe_Ribeir0_0-1674655501355.png

Just build the FileNewName column with the formula tool as you wish and it will work.

 

JamesJL
7 - Meteor

Hi!

 

My company is strict about downloading certain things. Is there an alternative?

Luke_C
17 - Castor

Hi @JamesJL 

 

Take a look at my solution to this post - sounds like a very similar fact pattern.

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Rename-300-PDF-files-within-Directory/...

 

JamesJL
7 - Meteor

I actually figured it out.

 

Regexreplace([filename], '(.)\s-.(.pdf)', '$1$2')

 

then another formula tool

 

"Rename "+' " '+[FullPath]+' " '+" "+ ' " '+Left(Filename), Findstring([Filename], '-')) + '.pdf" '

 

Granted I had some help but not bad for someone that has used it the past two months right??

Labels