How to move a directory and its files to a new path


#1

I´m trying to move a direcotry with its files to another path using “copy file”, but it doesn´t work. copy file


Move Folder to another Folder
Move directory did not work
Move all subfolders of a folder to another folder
#2

You can create a new folder and use Move File (using foreach)

or you may use

Directory.Move(sourceDir, destinationDir);


#3

Thank you @vvaidya. I want to use the second option, Directory.Move(sourceDir, destinationDir); but I don’t know where I have to put that instruction because it doesn´t return any value


#4

Hi ELanchas.

You can use the activity invoke method, in the Programming -> Execute -> Invoke Method.
Here is another topic that might give you more information on how to use it. Move a file or Rename a file

Note : Using the “move” it moves the file . It’s != copy. Make sure you know what you need.

Regards.


How to transfer multiple files from one folder to another based on current date
#5

Use below method, please note destination folder should not exist


Move/Delete a directory/folder
#6

Thank you @vvaidya, @Pedro_Pereira,

it works perfectly. Really I want to copy the directory, not move, but it seems that copy method doesn´t exist for Directory.

Regards,


#7

Folder Copy needs to by done file by file (foreach)


#8

Hi @vvaidya @ELanchas
Could you please share the sample project with us? regarding the folder move !!!

Thanks.


#9

i tryed this methode but it says: Move did not exist in system.IO.directory


#10

we can use Copy Directory method of FileSystem. here is the exampleCopyLogs.xaml (7.4 KB)

If destination folder is exist even though it will execute.


How to copy a folder?
#11

Please see following thread, looks similar to me.