In a folder i have multiple.xls files but i want to move particular file to other folder, How can i do that? Can anyone help me please

In a folder have multiple .xls files but in one variable i have store one file name. now in that folder i should compare all files with stored file name, if it matches i should move it to other folder,
Can anyone help with this logic please.

Loop using For Each File in Folder, Inside the loop do a string match after trimming and converting both sides to lowercase.

FilePath.ToLower.Trim = CurrentFile.FullName.ToLower



Use a For Each File in Folder activity and put an If activity inside to check for the filename match

If the filename matches the stored filename, use a Move File activity:


Checkout the XAML file attached and change the values before running.

FindFileAndMove.xaml (9.6 KB)

Hope this helps!

You don’t need Path.GetFileName - CurrentFile is an object that contains all those properties (ie CurrentFile.Name)

1 Like

This is sufficient to give you everything, like paul mentioned.


Much thanks! It’s a crutch I use whenever I’m not familiar with the object properties (wasn’t sure if .Name would give full name including directory or just the name) and sometimes get used unnecessarily. Cheers!

Hi, I cannot open the .xml file if u don’t mind can you please resend it. coz, i am getting error like file is invalid.

also, for each file folder activity which package i should install to get that activity can you plz tell me.


Sure, here it is with also the suggested change by @postwick on CurrentFile.Name

FindFileAndMove.xaml (9.6 KB)

The For Each File In Folder activity is available by default, what version of Studio do you have? Consider updating to new version if the activity is not available.

Good luck

Thankyou but still cannot open that .xml file i am getting an error like document is invalid only.
If u don’t mind can you plz send through zip file or any other way if possible.

i am getting these errors.

Try to check you version of Studio please. It may not be compatible with newer xaml files if outdated.


.Name gives just the filename

.FullName gives the path and filename

You can always look up the properties (and methods) by Googling “ fileinfo class” or whatever datatype you want instead of fileinfo

It’s part of the default packages, probably UiPath.System.Activities

It’s a modern activity so make sure your project is set to modern (Project Tab, Settings button)


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