|
-
Mar 11th, 2007, 08:08 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2005] how to create/delete folders?
Hello
I know this is easy, but couldn't find the answer in vb help.
I have 2 questions:
1- How can I create a folder such as "[SystemFolder]\Example\" ?
2- How can I delete a folder/file such as "[My Documents]\example.txt"?
Thank you
-
Mar 11th, 2007, 08:15 AM
#2
Re: [2005] how to create/delete folders?
You cannot modify any of the system's folders/files. What exactly are you trying to accomplish?
-
Mar 11th, 2007, 12:06 PM
#3
Thread Starter
Addicted Member
Re: [2005] how to create/delete folders?
You cannot modify any of the system's folders/files. What exactly are you trying to accomplish?
The exact thing I need for now, is deleting and creating files and folders. For example:
I want to create "C:\New Folder\"
and I want to delete "C:\New Folder\myfile.txt"
Thank you
-
Mar 11th, 2007, 12:34 PM
#4
Re: [2005] how to create/delete folders?
To create/delete a folder, you can use the Directory class. To delete a file, you can use the file class
vb Code:
If Not IO.Directory.Exists("C:\SomeFolderName\SubFolderName") Then
IO.Directory.CreateDirectory("C:\SomeFolderName\SubFolderName")
End If
If IO.File.Exists("C:\test.txt") Then
IO.File.Delete("C:\test.txt")
End If
-
Mar 11th, 2007, 02:39 PM
#5
New Member
Re: [2005] how to create/delete folders?
you can use this code its to sample
My.Computer.FileSystem.CreateDirectory("C:\NewDirectory").....to create
My.Computer.FileSystem.DeleteFile("C:\Test.txt", FileIO.UIOption.AllDialogs, FileIO.RecycleOption.SendToRecycleBin).........to Delete
Good luck
-
Mar 12th, 2007, 01:06 AM
#6
Thread Starter
Addicted Member
Re: [2005] how to create/delete folders?
Thank you Stanav and TheBeginner. You solved my problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|