ALTERYX INSPIRE | Join us this May for for a multi-day virtual analytics + data science experience like no other! Register Now

Alteryx Designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Change the names of multiple files from the same folder

Snord
6 - Meteoroid

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.

fmvizcaino
16 - Nebula
16 - Nebula

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

Snord
6 - Meteoroid

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!

hellyars
12 - Quasar

@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. 

hellyars
12 - Quasar

@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 

 

 

 

Screen Shot 2021-05-04 at 7.34.58 PM.png

ArtApa
Alteryx
Alteryx

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 

 

ArtApa_0-1620173960879.png

 

Snord
6 - Meteoroid

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

fmvizcaino
16 - Nebula
16 - Nebula

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

Labels