How to add 0000 digits in front of a PDF file name that doesnt contain 7 digits?

How can I rename a PDF file name and add 0 digits in front of it if the file doesnt contain 7 digits?


25.pdf should be renamed as 0000025.pdf
824.pdf should be renamed as 0000824.pdf
1624.pdf should be renamed as 0001624.pdf

Thanks in advance for your help

Hi @mce ,

MOVE FILE activity can be use.

That is get the pdf files from a folder using a assign activity like this

pdf_files = Directory.GetFiles(“your_folder_path”,”*.pdf”)

Where pdf_files is a variable of type array of string

  • now use a FOR EACH activity and pass the above variable as input
  • inside the loop use a MOVE FILE activity where in the path property mention as item.ToString
  • Store file name in one variable appened_file_name, Check the length and append 0’s to appened_0_file_name
  • in Destination property mention the “your_folder_path\”+”appened_0_file_name”+”.pdf”

Hi @mce ,

For Appending 0’s to the file name you could use the below Expression :



For renaming the File, You would have to use the Rename/Move File Activity by modifying the File name / File Path in the below manner :


Let us know if this doesn’t work.

FileRename.xaml (9.7 KB)
Hi @Maic Ceriani

Kindly refer to the attached XAML to rename the file.
If you have any doubt. kindly reply

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.