How to rename several number of Files in folder

Hi to all,

I have a folder containing about 40,000 documents, to be renamed.
I would have to rename them all to a simple number series, from 00000 to 40000.
Anyone have any idea how to make this work?

Hi

Hope the below steps would help you resolve this issue

  1. Use a assign activity like this

arr_filepath = Directory.GetFiles(“yourfolderpath”)

Where arr_filepath is a variable of type array of string

Meantime create a variable named counter in variable panel of type int32 with default value as 0

  1. Now use a FOR EACH activity and pass the above variable as input and change the type argument as string

  2. Inside the loop use a MOVE FILE activity and mention the properties like this

In Source or From property mention as item.ToString

and in destination or To property mention this expression

Path.GetDirectoryName(item.ToString)+”\”+Path.GetFileNameWithoutExtension(item.ToString)+”_”+counter.ToString+Path.GetExtension(item.ToString)

  1. Next to this Move file activity inside the same loop use a assign activity like this

counter = counter + 1

Cheers @AaronMark

OK, I forgot a detail.
In your opinion, is it possible, from file, to locate the creation date, and create the folder with the reference year? And then put all the documents from that year in that folder?
Many corporate documents are being digitized, and therefore I have to archive .doc, jpeg, pdf …
I’m looking for a way to better organize it.

EXAMPLE.xaml (13.1 KB)

Pls try this, and feedback if it’s ok or not.

Thanks !

1 Like