renaming the files - VisualCron - Forum

Community forum

Ujma
  •  Ujma
  • Paid support Topic Starter
2020-05-20T22:42:57Z
HI,

I wan t o remove the white space from the file name (for example : abc xyz 123.xlsx)and want to replace it with the "_" underscore (for ex: abc_xyz_123.xlsx), there are multiple files in the folder,
How can I do this ?

Thanks in advance.

Support
2020-05-22T12:26:30Z
Originally Posted by: Ujma 

HI,

I wan t o remove the white space from the file name (for example : abc xyz 123.xlsx)and want to replace it with the "_" underscore (for ex: abc_xyz_123.xlsx), there are multiple files in the folder,
How can I do this ?

Thanks in advance.



You can use the rename file task and use this variable in post process: {STRING(Replace|{NEWNAME()}| |_)}

It will rename all spaces with underscore.
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Ujma
  •  Ujma
  • Paid support Topic Starter
2020-06-23T22:27:47Z
Hi Michael ,

Thank You for your reply.

I have another Question, how can I remove "-", "blank Space", "()" from a file name like using single Regex and replace all of this with "_"

For example file name is like this : xyz abc asd April 28 2020 - xyz(1)_2020_06_18_1523

Can you please help me with this.

Thank You.
Gary_W
2020-06-24T13:31:33Z
Not sure what your approach is but a regex to do it is:

{REGEX(Replace|xyz abc asd April 28 2020 - xyz(1)_2020_06_18_1523|[- ()_]+|_)}

Result (note you will get multiple underscores in a row so the underscore needs to be part of the match set):

xyz_abc_asd_April_28_2020_xyz_1_2020_06_18_1523

Regex explained:

[] - defines a character set
[- ()_] - inside the set are the characters dash, space, open and close parens and an underscore. The underscore needs to get matched too for the following regex match character.
+ - Match 1 or more of the previous character
So it means match 1 or more of the previous characters and replace with a single underscore
Ujma
  •  Ujma
  • Paid support Topic Starter
2020-06-24T17:24:44Z
Thanks much Gary!,
It worked.

Scroll to Top