Search code examples
vb.netmovexcopy

Xcopy equivlent for VB.net


Simple question how do i copy and move the entier contents of a directory to another ussing VB.net then also delete the files from there original directory?


Solution

  • I think this is the easiest way:

    FileIO.FileSystem.CopyDirectory(sourceFolder, outputFolder)
    FileIO.FileSystem.DeleteDirectory(sourceFolder, FileIO.DeleteDirectoryOption.DeleteAllContents)
    

    There are additional overloads with a few more options, like showing dialogs to the user during copy.