Copying 4 files from multiple Directories to another Symmetric Directories

hi Need Help in making a Flowchart where i want to get few PDF files with specific name like partial text name common in every folder “applicantPAN” and “ApplicantImage”. Where i want to only copy those 2 files with provided partial text of the file name and copy to other folder.

Use For Each Item : directory.GetFiles(“FirstFolderPath”)
If: Item.ToString.Contains(“Common Name”) and Item.ToString.Contains(“.pdf”)
Then Use Move File

2 Likes

I am not able to do please send one sample file to try

Its working thank you but if i have multiple directories in main folder then how can i automate that?

U can use Directory.GetDirectories
In that Use directory.GetFiles

1 Like

Yes i have used that now its working but now i am stucked at place where i have to create similar directories as its in Source directory. need replication of Source directory.
how can i do that ?

what exactly you want do?

there are 1000 sub folders in a Mainfolder1 , in every sub folder i have 10-15 .pdf files with different names which are common in every sub folder. So i have to copy 2 files from every sub folder and have to paste to another sub folder of same name of Mainfolder1 of another Mainfolder2 .
Ex; MainFolder1>subfolder1(have to copy only two files with name contains(applicantpancard12345).pdf
and (applicantimage12345)),Subfolder2(),subfolder3
have to copy files to
MainFolder2>subfolder1(two files with name contains(applicantpancard12345).pdf
and (applicantimage12345)),Subfolder2(),subfolder3

i need to do this process.
Please any one help in this.

As per my understanding
Files from Subfolder1 of MainFolder1 has to be copied to Subfolder1 of MainFolder2?

yes thats right. Subfolder1 and subfolder2 name should be same. in both the different mainfolder1 and 2.

Then what exactly problem you are facing you just need to give path if condition met

i have to Copy file to subfolder in destination mainfolder.
which i am not able to do. My files from all the sub folders are copying to main folder. I want to move that to their sub folder.

Give path as
Source:
“MainFolder1\Subfolder1\ABC.pdf”

Destination:
“MainFolder2\Subfolder1\ABC.pdf”

How should i create a destination path as my sub folder are dynamic. it keep adding day by day.
So i want some thing like that where destination sub folder are created during automation and should copy the required files to sub folder one by one.

Then use create directory while copying the file

. Please check this?

@vijaykumar_lod
Try this to create: MainFolder2\Subfolder1

Try this to move file

1 Like

Can you please send me the file of sample you created. I need to try the same what you sent.
thank you in advance

thanks every one for their help.
Its working perfectly.

1 Like

Hi @vijaykumar_lod

below is the sample file

Directories.xaml (7.1 KB)

1 Like