How to move files within a directory to a directory in a shared cloud?

Hi all,

I’m facing a bit of an issue here. I have directories with a specific name with files in them and I need to move or copy the directories with the files to a shared drive not depending whether the destination directory already exists or not.

I tried to use the “Invoke Method” activity with TargetType “System.IO.Directory” and MethodName “Move”; This only works if the destination file is not existing. This should not a dependency.

Effectively, it is the following what I need: What this video shows, but then with folders, as this does not work with moving folders: UiPath Tutorial For Beginners - Move file activity - YouTube

For Example:
The folder named “X” is located on "C:\Users\MyUsername\Documents" aswell as on the shared drive (which is the target destination).
The files within in folder “X” in my documents need to be moved or copied to the shared drive, but we will use/move multiple folders; Not only folder “X”, but also Folder “Y” and “Z”. Effectively we need to have this looped, but looping over folders is not our issue here (as of now).

I hope this is clear and understandable. Should I need to elaborate this more, please don’t hesitate to ask.

Kind Regards,

1 Like

Well, you have move activity in Uipath.
fro my side: You can always enumerate all files to move (from the folder) and make a loop with move. And you should add if astatement to check if the folder exists or not. If not, jsut create it.

Thankyou for your solution but fortunately I resolved this problem in another way.
I’ve used “Invoke Method” activity with “Microsoft.VirtualBasic.FileIO.FileSystem” as TargetType and “CopyDirectory” as MethodName.

image

1 Like

Not working