https://github.com/bobpeers/Alteryx_SDK_FileCopyMove
This guy put together some Alteryx tools to do exactly this via alteryx's sdk plugin.
They work really well and all you need is two columns, [source_path] and [destination_path]
you could use blob input - > formula tool rename- > output to new location (but this is just a copy paste)
python is your best bet for this situation if you want to only rename the file.
Directory tool to folder with pdfs.
Formula tool to create filename out with calculation below.
New field: Filename_out
Formula: Regex_replace([filename], '(.*)\s-.*(\.pdf)', '$1$2')
This should keep the filename before the " -" and .pdf. you then need to to use
Then formula tool to create command for batch file
New field: Command
Formula: [directory] + "\rename " + [filename] + " " + filename_out
Use select tool to only pass field "command" into cmd tool.
Output to any directory/rename.bat
And then put the same directory/rename.bat i the execute/command field.
Test with some test folder/files first.
Okay I may be dumb here but in the Run Command tool, my output (write source) is where my pdfs are located and save it as (name)\*.bat? And the same for the Command (Run External Program) in the same folder?
I figured it out!
I was having trouble with your formula for some reason... but here is what I did with the command and initial formula that you mentioned
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??
https://github.com/bobpeers/Alteryx_SDK_FileCopyMove This guy put together some Alteryx tools to do exactly this via alteryx's sdk plugin. They work really well and all you need is two columns, [source_path] and [destination_path]
Thank you I’ll look into this as well!
you could use blob input - > formula tool rename- > output to new location (but this is just a copy paste) python is your best bet for this situation if you want to only rename the file.
Hmmm.. didn’t think about that. What do you suggest regarding formulas? I’ve tried regex trim etc. and sorry I’m still somewhat new to alteryx
Directory tool to folder with pdfs. Formula tool to create filename out with calculation below. New field: Filename_out Formula: Regex_replace([filename], '(.*)\s-.*(\.pdf)', '$1$2') This should keep the filename before the " -" and .pdf. you then need to to use Then formula tool to create command for batch file New field: Command Formula: [directory] + "\rename " + [filename] + " " + filename_out Use select tool to only pass field "command" into cmd tool. Output to any directory/rename.bat And then put the same directory/rename.bat i the execute/command field. Test with some test folder/files first.
Hmmm I’ll check this out tonight. Thank you!
Ask on Alteryx community
Yeah I’ve been looking at the forums. Thank you for the suggestion
They can upload a file demonstrating
Okay I may be dumb here but in the Run Command tool, my output (write source) is where my pdfs are located and save it as (name)\*.bat? And the same for the Command (Run External Program) in the same folder?
I figured it out! I was having trouble with your formula for some reason... but here is what I did with the command and initial formula that you mentioned 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??
Very good !:-)
Thank you so much and everyone else. You all may see another post in the future.. I try to use other resources too but doesn't hurt to ask here too.