Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

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

Rename a file after processing

Bbadef
8 - Asteroid

Hi everyone,

I have a question with run command tool and if I can get help from you guys, I will be appreciated!

I found a answer from https://community.alteryx.com/t5/Alteryx-Designer-Discussions/Renaming-files-at-system-level/td-p/37... about how to rename a file

 

What I wrote in  cmd is: 'ren '+[Directory]+[FileName]+'  '+'PROCESS-'+[FileName] to rename the file.

However, I just realize there is space in the path so there is always an error 1 message. I've attached an example for the path,folder and file. 

Path:C:\2021 Inventory\Fresh Fruit\Apple

Folder:September 2021(changed based on moth)

File: apple sale_11_08_2021.xlsx(changed based on day)

What I expect is PROCESSED-apple sale_11_08_2021.xlsx  after processing.

 

If I can get some advice for how can I make it work, I will be appreciated!

4 REPLIES 4
AZuc
Alteryx Alumni (Retired)

@Bbadef if there's a space in the path or filename, you must build your expression putting the files in quotes

Ex:

 

ren "C:\2021 Inventory\Fresh Fruit\Apple\apple sale_11_08_2021.xlsx" "C:\2021 Inventory\Fresh Fruit\Apple\PROCESSED-apple sale_11_08_2021.xlsx"

André Zuccatti

Sales Engineer - LATAM -
Alteryx, Inc.


AZuc
Alteryx Alumni (Retired)

or

 

'ren "'+[Directory]+[FileName]+'"  '"+'PROCESS-'+[FileName]+'" '

André Zuccatti

Sales Engineer - LATAM -
Alteryx, Inc.


Bbadef
8 - Asteroid

Hi Azuc,

Thank you for your help!It works like a charm!

cmsteinberg
5 - Atom

Hello.  I am wondering if there is a way to capture the original source file name by using the directory tool, and then pulling it into the rename formula?

I was thinking the select records tool or sample first n when n=1.

 

Thanks.

 

Labels