Move/Delete a directory/folder




I am trying to move/delete a particular folder.

Inside the folder, there are more folders, and inside those folders, they might be more folders, and finally in those folders are the files.

are there any straightforward way to just move/delete that entire top folder?

Move Folder to another Folder

The move file activity also takes a directory as a parameter so will move the whole folder.


@richarddenton Last I knew, Move File doesn’t work for Directories and says File was not found error.

Here are some solutions I use:


i believe those wouldnt work for me case too… considering i have an unknown number of folders inside the folder i want to move.


Hi @tzj,

Not sure why @ClaytonM’s second solution wouldn’t work but you can also move the Directory by invoking the MoveDirectory method. The TargetType is Microsoft.VisualBasic.FileIO.FileSystem.



Hi @tmays,
Refer this image



can i rename the folder using the same way as moving the directory mentioned above?

the source folder name has to be fixed. i need to move it to another directory for backup. I intend to add date behind the folder name, but there is no rename activity either.


Hi @tzj,

You can use VB .net syntax to add the date behind the folder name as below:



Hi @tzj,

yes you can do.

Refer the image.

in second parameter you can change the Folder name "C:\Users\share\Desktop\dest" to



Hi @tzj

How about [System.IO.Directory.Delete] method.
It can directly delete your target directory .
And the In parameter [TRUE] will remove directories, subdirectories, and files .

And use [System.IO.Directory.Move] method can move the whole directory to another location.
(just like @arivu96 has mentioned above )
Also you can rename the folder using this mothod when move the director .


Thanks guys. I have solved my problem.
Marked @arivu96’s reply as the solution as his screenshot is the clearest/easiest to understand.

Note that the Move method requires that the destination directory(second parameter) to not exist.
The method works like this: it will first create a folder in the specified destination parameter, and the contents from source folder will be moved to that folder.

Thanks everyone. appreciate the help :slight_smile:


Hi @arivu96, is there a way to move folders/files using the Invoke method across different volumes/root folders?

I got the below exception as I am trying to move a folder from my desktop to a shared drive.

Message: Source and destination path must have identical roots. Move will not work across volumes.


I found the solution via another post.
Just use this in the Invoke method:
TargetType: Microsoft.VisualBasic.FileIo.FileSystem
MethodName: MoveDirectory