Copy Create Delete Rename a Specified Directory ' 'Copy, Create, Delete, and Renaming a Directory. ' Dim dir As String = "c:\Directory" ' 'Create a directory with the path and name specified in the dir string variable. My.Computer.FileSystem.CreateDirectory(dir) ' 'New directory with the contents of the dir path copied to it. /span/p My.Computer.FileSystem.CopyDirectory(dir, "c:\Directory Copied") ' 'Rename the original directory that is specified in the dir variable to the new directory name. My.Computer.FileSystem.RenameDirectory(dir, "Directory Renamed") ' 'Delete both the Copy Directory and the Renamed Directory from the harddrive./span/p My.Computer.FileSystem.DeleteDirectory("c:\Directory Copied", _ FileIO.DeleteDirectoryOption.DeleteAllContents) My.Computer.FileSystem.DeleteDirectory("Directory Renamed", FileIO.UIOption.AllDialogs, _ FileIO.RecycleOption.SendToRecycleBin, FileIO.UICancelOption.DoNothing)
|