Move File becomes read only

I want to move all the files in a specified folder to an another (archive) folder. I have found the move file activity from UiPath.Core.Activities.MoveFile

When i simulate a “move file activity” in a sequence i have to select a file-name (for example a excelfile) form a folder. That works and in the to-folder I only provide the name of the folder.
When ik want to move all the files in a specified folder and I just drop a folder-name in the “from folder” of the activity it becomes 'read only" after running.

Can ony one help me?

If I’m not mistaken, this activity will execute a move file command, but will not wait for the move to be completed. You’ll need logic in your code to wait for the file to be fully moved to the target directory to gain read access.

I dont think pointing to a folder is the way to use this, if you want to move all files, your should first get the files from the folder using like https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?view=netcore-3.1 and the in a for each, use the move file activity.

1 Like

Thanks you all. the directorygetfiles method got me on the right track. :+1:

1 Like

I already have build to move files in a specified folder to an another (archive) folder. I have attached the code.

This is now built in for 1 location. The entire process is completed per location and a different location starts via a loop. I want to make the archive container variable so that all locations are picked up. In the attachment also a photo of the folder structure.
Anyone have an idea? Thanks already


move file7.xaml (5.1 KB)

Look my solution, hope i understood what you needed… And please be careful before running this on important files :slight_smile: move file7.xaml (8.7 KB)

Hello Bcorrea,

Thanks for your possible solution. I just can’t open your xaml properly. Can you take a screenshot just like I did?

Don’t mention my last question. I have updated my packages and now i can read your file.
Thanks already

1 Like

Youre the man! Thanks, it works fine :grinning: :grinning:

1 Like