Hi All, how to create folder names according to file names

I am trying to copy all multiple excel files from one folder to other folder and after copying files to destination path i need to create folder names according to files i copied and move the files to respective folders and this should apply for multiple files copying and creating folders for them.

Thanks in Advance.

1 Like

First,
1.ArrayString = Directory.GetFiles(“FolderPath”), you will get full path with filename and extension.

2.Next use for each and pass “ArrayString” variable to it. Inside for each create FileName(FileInfo type) = New FileInfo(item).

3.Use to below code to get the name,
System.Text.RegularExpressions.Regex.Matches(FileName.Name,“[\w].*(?=.)”)(0).ToString

4.Use create folder activity from the file name which you get from the 3rd step code.

Is this applicable for multiple files copying also right?

Check this workflow,
Test.xaml (5.2 KB)

thanks, i will check

I have opened your file but it showing some error

@praveenM1 What is the Error?

Actually my scenario is i am trying to copy mutliple files from one folder to another folder and then in destination folder i have to create folder names according to files i copied. For this i tried for each loop but not getting the output

I am not getting how to assign this

@praveenM1 Can you check if this is what you needed :

  1. Delete the sub Folders present in Destination Folder

Run the Process and Check Destination Folder

CopyFilesToFolder.zip (584.0 KB)

Sequence (1).xaml (10.7 KB)

Sequence.xaml (10.7 KB)