I have 50 files in a folder that I want to rename. The files in the folder are constantly changing and being updated, so I want to be able to change the file names as they are updated. The idea that I have now is to use the directory tool to bring in all the file names, the RegEx tool to pull the specific portion of the current file name that I want, and then export it via the output tool. However, I'm unable to configure the output tool to rename the files. I tried updating the configuration at the bottom to be "Take File/ Table Name from Field" and "Change File/ Table Name" but that is not working for me.
Any suggestions would be really appreciated.
Hi @Snord ,
I just answered a post here 5 minutes ago, I will be sending the example showing how to do it.
Here I'm showing how to get the file name and to replace the name in a dynamic kind of way. Yours will be simpler.
But another suggestion is for you to use a great tool designed by one of our users @bobpeers that renames files without even opening them in Alteryx.
https://gallery.alteryx.com/#!app/File-Operations/5f4016520462d715e4d43e97
Enjoy!
Fernando Vizcaino
Thank you for the suggestion Fernando. The issue I'm running into with using the input tool is that the file structure is different for each file. Not all the files have the same sheet names so using the input tool with a dynamic input wouldn't work.
I was looking at what you sent from @bobpeers but the python code suggested gave me an error when I tried running it (unable to resolve plugin Python).
Thank you for trying!
@Snord Could you not use a Run Command tool to run a .bat process file to rename the files as names. I had to do this a few times last year. I just need to find my example. I will put it up when I find it.
@Snord Hopefully, I remember this correctly. I was moving files in and out of a folder to rename them. The rename process involved a little regex and joins, etc. Once I had the new file name created, I used the Run Command tool to run a .BAT command that renamed all the files. I attached an image of my workflow -- the image includes the configuration of the Run Command.
Not that it matters, I am a Mac person and did not know how to do this dynamically on a PC until I got this to work. Also, I picked this up from another Community Post. I will post the citation if I can find it.
Update: Here is the link to the solution that inspired me. Link
Hi @Snord - Attached is an app that will rename your files.
1) You need to select a folder
2) Enter a search word
3) Enter a replace word
Thanks for all the suggestions. I think a big issue that I'm running into is the fact that the files have different structure (some are .xls, .xlsx, .csv and most of them have different tabs with data starting on different lines.
I found this article that gave some more ideas about it as well.
Dynamically Rename Processed Files within Alteryx: A Step-by-Step Guide - The Information Lab
Hi @Snord ,
The @ArtApa suggestion renames all files disregarding its format, @bobpeers tool does that as well, maybe he can answer you better after check this thread, he usually does.
About the different formats, there is a weekly exercise that shows how to create a macro to read any format you want.
https://community.alteryx.com/t5/Weekly-Challenge/Challenge-180-Thousand-File-Challenge/td-p/461356
Best,
Fernando Vizcaino
@ArtApa I love this. I use the back end to batch rename PDF documents. Any ways, I've run into an issue with it over the past few days. It won't work (even in its original configuration right after download). This is the typical error:
The external program %temp%\CopyTemplate.bat"returned an error code of 1
I can see the window pop up and it read thru the list of documents, but it does not change them. I can also run the .bat file from the results window, but the same story.
Any ideas?
Hi @hellyars - Do you have permissions to change names in the selected folder? I'd suggest you to run the bat file manually and see if it works. Your issue is likely is bat file related, i.e. outside of Alteryx.
User | Count |
---|---|
17 | |
15 | |
15 | |
8 | |
5 |