Find repeated file name

Hi all.

My folder contain file name:
Interview_01 Oct.pdf
Interview_02 Oct.pdf
Address.pdf
Place.pdf
Contact.pdf

I want to get all file name that contain interview and rename it to form
If there is 2 interview file then rename it to form_1 , form_2.

Can help on this? Please…

Hi @f5f191b0815b26e83996fd67f

Fallow the steps below. If I helped you, please mark it as solved.

Step 1
Assign: Create a files variable of type Array of String and assign it the value:
Directory.GetFiles(“FolderPath”, “Interview.pdf”)
This will return all files that contain “Interview” in the name.
Step 2
For Each: Iterate over the files array to rename the files:
TypeArgument: String
Step 3
Assign: Inside the For Each, create a counter variable (initialize outside the loop).
Assign counter = counter + 1 inside the loop to count the files.
Step 4
Move File: Rename the file using Move File.
Path: The full path of the current file.
Destination: The new name of the file, for example:
Path.Combine(“FolderPath”, “form_” + counter.ToString + “.pdf”)

Hello @f5f191b0815b26e83996fd67f
Please find attached a solution to your request.

RenameFileAction.xaml (12.4 KB)

Hi @f5f191b0815b26e83996fd67f

Follow the below steps,

Before rename the files look like below,

After Renaming,

Steps:

Assign the Integer Variable IntCounter = 1

Then use the for each activity,

*In → System.IO.Directory.GetFiles("D:\Testing_Purpose\New folder (2)\","Interview*.pdf")

Inside For each use the rename File activity

File → currentText.ToString

New Name → "D:\Testing_Purpose\New folder (2)\"+"Form_"+IntCounter.ToString+".pdf"

Regards,
Gowtham.K