How to change the file’s name

dear all,
i have a question wanna to get help, for example
image

there is a folder, the folder’s is 5-FB030030-xxxxxxx

and there are some word (or pdf) files in this folder,

image

i want to change the all the file’s name in this folder, the change approach as follows
the 20191011_001000_xxxxxx.docx file’s name is changed to
CN_50570000_001000_FB030030_20191011.docx

the 20191024_000984_xxxxxxxxxx.docx files name is changed to
CN_50570000_000984_FB030030_20191024.docx

how could i deal with problem ? anybody could give me a demo code ?

Thanks so much in advance !

@Chris-Yiwei -
take a variable to set the file name…use filename.Split(“_”), this will split the filename…then assign newfilename variable to CN_50570000_arr(2)_FB030030_arr(1).docx
then you can use MoveFile actiivty and change the filename in destination path property.

thanks a lot for your help, becasue i am a freshman ,could you give me the demo code ? i learn about it

I have created an workflow on the basis of your requirement just change the things as per ur need
Flowchart.xaml (7.3 KB)

thanks a lot ,
another question, the folder’s name would change , it means that the FB030030 is not fixed
how could i get the string of folder’s name

another question, the folder’s name would change , it means that the FB030030 is not fixed
how could i get the string of folder’s name

thanks a lot for your help, becasue i am a freshman ,could you give me the demo code ? i learn about it

You can first get the folder name with -
var = Directory.GetDirectories() function
so if you have only 1 folder then you can take that foldername and then again split and take the 2nd argument value and process it further with workflow.

I have some upload restrictions…so can help with logic but not with files…

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