Find excels and move them to other directory if the excel file name contains the word (doc)

Hi All,

I am trying to find all the excels in a directory which contains (doc) in there name and then copy them to other directory.

Could someone please help.

Regards,
Rahul

1 Like

Hi
hope these steps would help you resolve this
–use a assign activity like this
arfiles = Directory.GetFiles(“yourfolderpath”,“*.xlsx”)
where arrfiles is a variable of type array of string
–now use FOR EACH loop and pass the above variable as input
–inside the loop use IF condition like this
item.ToString.Contains(“doc”)
if true it goes to THEN part where use a MOVE FILE activity where mention the input path as item.ToString and destination with the folder you want to move the file

Cheers @rahul_gola

1 Like

Hi Palaniyappan,

happy new year.

its very great to hear from you. i am checking the activity suggested by you and will get back to you soon.

Regards,
Rahul

1 Like

Hi Palaniyappan,

I am having an error attaching the DOC_Find_Copy.xaml (7.6 KB)

Thanks,
Rahul

hey sorry i have missed to for each LOOP activity

1 Like

hi Palaniyappan,

This is working amazing, i looking to do some modification as in now there is one folder which contains sub folder i need to look for the (doc) file in each of the sub folders and move them to a directory.

the above suggestion is working like a charm.

could you please help with this as well.

Regards,
Rahul

1 Like

Sure
To get all the files in. Sub folder then
arrFiles = Directory.GetFiles(yourfolderpath,“*.xlsx”,SearchOption.AllDirectories)

Cheers @rahul_gola

1 Like

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