Copy directory to another directory when files are in use

I’m trying to copy Folder A to Folder B using an Invoke Code with Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory. Most of the time this works correctly, but when someone else has a file in Folder A open the process errors. Is there any way around this issue? I’d like to just copy whatever the last saved version of that file is and not have to worry about whether someone is in the files or not. Files in Folder A are .xlsx in case that matters.

image

@Mecarter

It’s a windows default, You also can try manually

If you open a file in directory and try to paste that directory, It will throw you the same error

Hope this helps

Thanks

You can do it in uipath as well. Create a copy of the file, in this way if someone is using that file it will not throw an error and create copy of that file in the destination folder.CopyOfFile

Interesting! I was using the Copy File in another part of this workflow but didn’t realize that it would copy open files where the other would not. Thank you!

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