Rename files in a folder

  1. I am having many different files in one directory with different extensions(pdf, xlsx, jpg) etc…
  2. I need to read the filenames from the folder. Rename the filenames with “_success” Extension for the name.
  3. how to perform this action dynamically.
    Think files are in Input folder and destination files should be output folder.

Thanks in advance

Hi @bbysani,
Welcome to the forum

In Assign activity, please do this:

  1. Create a variable that is an Array of String (String). Let’s say arrFiles as the variable name
  2. In the Assign activity,
    arrFiles = Directory.GetFiles("folderPath", "*.*")
  3. Use For Each activity to loop through the array
  4. Inside body of For Each use Copy File activity

for details regarding Copy File activity visit the following link:

Hope it helps


1 Like
  1. Add a For Each activity with the inputFile as For Clause and Directory.GetFiles(“inputFolderPath”, “.”) as in Clause.
For each inputFile in Directory.GetFiles("inputFolderPath", "*.*")
  1. Inside that for each use the Copy Activity with the below properties.
    Source : inputFile
    destination : “outputFolderPath” + path.getFilzeameWithoutExtension(inputFile) + “_success”+path.getExtension(inputFile)
    That’s it.

Thanks for posting here.


Thanks much, This helped and able to get the desired output.

Thanks for the link and command.

Please accept the solution if you are happy with it

Karthikeyan Ramamoorthy

1 Like

In this video I do a lot of stuff with Files (Chapter included) :

1:10 Download the file and Move the latest file to folders
4:30 Rename files with VB commands
6:00 Move files to do Rename
6:55 Delete files
8:15 Delete only PNG files
8:55 Delete all the files except PNG files
9:55 Move files
11:10 Delete files that are older than 2 weeks
14:40 Create a file or folder with dates inside

Cristian Negulescu