Renaming csv files in same folder

I want to rename some files for eg “CASE-00461” to “461” in same folder ,Any suggestion on how we can achieve that?

1 Like

@rohit0510

use move file activity::

input: source file name(with whole path)

output: same path as source file but change the file name

Hope it works.

Cheers

@rohit0510

Use Move file Activity
movefile.xaml (4.4 KB)
Thanks,
Suresh J

1 Like

I have multiple files how trim file name each time?

@rohit0510

first create a string array like file_list then use assign like this

file_List = Directory.GetFiles(FolderPath,searchPatter)

FolderPath is a variable for the folder contaning all the file
Search pattern is a string type variable with default value “*.csv” (Since you are trying to change only CSV files.)

Then use for each activity and change the type to string from object in properties

Use the move file activity inside the for each activity. But the name use using at output property in the move activity should be dynamic.

It should work.

Cheers

No worries
Hope these steps would help you
—use a assign activity and mention like this
Out_filepath = Directory.GetFiles(“yourfolderpath”,”*.csv”)

Where Out_filepath is a string array variable

—now use a for each activity and pass the above variable as input and change the type argument as string in the property panel of the for each activity

—inside the loop use use the activity MOVE FILE activity and in the source mention as item as that’s the variable now holding the filepath from for each loop and in the destination property mention with the file name we want with the filepath

That’s all you are done
It will get moved to the folder we want with the file name we want

Cheers @rohit0510

Hello Rohit,
In this video I do a lot of stuff with Files and also Rename files in multiple ways :

4:30 Rename files with VB commands
6:00 Move files to do Rename

Thanks,
Cristian Negulescu