Copy Files With specific name and extention

Hi,

My aim is to copy all the files in the directory which contains the specific name “IGM042” and “.xls”.

I’m using the for each activity to get all the files in the directory and if activity to pick the files

But it seems something wrong inside the “Path.GetFileName(item.ToString)=“IGM042*.xls””

After I ran the Robot none of the file was copied to the destination directory.

Capture

The if condition is incorrect. Basically you are looking if each file is IGM042*.xls.
“*” will not be considered anything in this context.

Please use the below condition in the IF -

if Path.GetFileName(item.ToString).StartsWith("IGM042") And Path.GetFileName(item.ToString).EndsWith(".xls")

Thanks a lot!

1 Like

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