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.
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.
in second parameter you can change the Folder name "C:\Users\share\Desktop\dest" to "C:\Users\share\Desktop\"+DateTime.Now().ToString("MM/dd/yyyy")+"dest"
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.
I found the solution via another post.
Just use this in the Invoke method:
TargetType: Microsoft.VisualBasic.FileIo.FileSystem
MethodName: MoveDirectory