In: Computer Science
Visual Basic
Make a directory and copy some files from desktop to the created directory
QUESTION: Visual Basic - Make a directory and copy some files from desktop to the created directory
Sol:
To create a directory:
Example:
My.Computer.FileSystem.CreateDirectory( "C:\Documents and Settings\All Users\Documents\NewDirectory")
Copy files from desktop to created directories:
The following code examples demonstrate how to use CopyFile:
Copy the file to a new
location without overwriting existing file.
My.Computer.FileSystem.CopyFile(
"C:\UserFiles\TestFiles\testFile.txt",
"C:\UserFiles\TestFiles2\testFile.txt")
Copy the file to a new
folder, overwriting existing file.
My.Computer.FileSystem.CopyFile(
"C:\UserFiles\TestFiles\testFile.txt",
"C:\UserFiles\TestFiles2\testFile.txt",
Microsoft.VisualBasic.FileIO.UIOption.AllDialogs,
Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing)
Copy the file to a new
folder and rename it.
My.Computer.FileSystem.CopyFile(
"C:\UserFiles\TestFiles\testFile.txt",
"C:\UserFiles\TestFiles2\NewFile.txt",
Microsoft.VisualBasic.FileIO.UIOption.AllDialogs,
Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing)