Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Renaming folders in bulk

iamdata
8 - Asteroid

I have a question from someone here in the office.  

 

we have a library on the LAN full of folders which they want to change how we save them!

 

i had these example folders in this format and i would like to change to their format, but use Ateryx to do this in bulk!

 

before:

deal1 jan19

deal2 jan19

deal3 jan19

deal4 feb19

biscuit feb19

dog mar19

parrot apr19

 

 

 

after

201901_deal1

201901_deal2

201901_deal3

201902_deal4

201902_biscuit

etc..

 

 

 

my question is, can alteryx be used to rename these folders or will i need to use linux MV or rename commands to look for these,  i started with linux but then got angry around all of the use of brackets and the effort they add.

 

my other thoughts for the solution was a batch file or possibly  a vba excel solution, but i tend to shy away from VBA nowadays!

 

 

 

3 REPLIES 3
afv2688
16 - Nebula
16 - Nebula

Hello @iamdata ,

 

Was a tricky question but I can tell you yes, it can be done.

 

Type the following command in the run command tool:

 

if exist "C:\...\....\deal1 jan19" (
cd "C:\.....\..."  && rename "deal1 jan19" "201901_deal1"
)

 

Use it as a macro and modify the 4 parameters which are:

 

1.- C:\...\....\deal1 jan19   ==> Original path of the file   (example: C:\Users\ESd01631\Desktop\deal1 jan19)

2.- C:\.....\...                     ==> Previous path      (example: C:\Users\IronMan\Desktop\ )

3.- deal1 jan19                ==> old folder name

4.- 201901_deal1           ==> new folder name

 

leave the quotes out meaning you only update the content within the quotes

 

I tried it and it worked for me

 

Cheers

danilang
19 - Altair
19 - Altair

Hi @iamdata 

 

You can try this one as well

 

WF.png

 

The top branch of this workflow, up to the Append Fields, gets the list of directories, something that is not easy to do in Alteryx.  Many thanks to @jdunkerley79  for this part.  Once you have this, the formula tool builds the "Ren" commands and the final Run tool does the deed

 

Pre

 

pre.png

Post 

 

Post.png

 

Dan

iamdata
8 - Asteroid

Thanks both of you.

 

I used the second solution, purely because there was a workflow attached!  im still new to macros, but this is amazing.  I put into a test location and ran it, working well!  didnt pick up from Nov info, but i would rather rename 5 items instead of 60 folders!

 

appreciate the help with this.

Labels