|
-
Apr 12th, 2012, 10:55 PM
#1
Thread Starter
Junior Member
deleting a directory
ok what im trying to do here is to delete a whole directory and also stop the program at the same time it doesnt delete the folder but does close the program here is the code
Code:
Dim ProcessProperties As New ProcessStartInfo("cmd.exe", "/C ping 1.1.1.1 -n 1 -w 2000 > Nul & Del " + Application.ExecutablePath)
ProcessProperties.CreateNoWindow = True
Dim myProcess As Process = Process.Start(ProcessProperties)
Application.Exit()
im very new to coding but learn fast just dont know how to do it
-
Apr 12th, 2012, 11:10 PM
#2
Re: deleting a directory
Hello,
Well, in the code you posted, there's nothing related to deleting a directory
This is how you delete a directory:
Code:
Dim path As String = "C:\DirectoryToDelete\"
System.IO.Directory.Delete(path, True)
Change the path variable for the correct directory you wish to delete. It will delete the specified directory along with all its files and folders contained inside of it.
HTH,
HoraShadow
I do like the reward system. If you find that my post was useful, rate it.
-
Apr 13th, 2012, 12:30 AM
#3
Thread Starter
Junior Member
Re: deleting a directory
i need to delete the folder no matter where it is in the computer and i know it has to do it something along the lines of the code i posted the one you posted works yes but that is only if the folder is where it is exactly
-
Apr 13th, 2012, 12:41 PM
#4
Thread Starter
Junior Member
Re: deleting a directory
bump i really need help with this
-
Apr 13th, 2012, 07:40 PM
#5
Re: deleting a directory
 Originally Posted by tekatsu
i need to delete the folder no matter where it is in the computer and i know it has to do it something along the lines of the code i posted the one you posted works yes but that is only if the folder is where it is exactly
HoraShadow reply allows you to do what you want, in their example path variable is whatever you want in regards to a location on a PC. Is there something I am missing?
-
Apr 13th, 2012, 07:58 PM
#6
Thread Starter
Junior Member
Re: deleting a directory
ya i need it to delete its self and the folder it is in no matter where it is on the computer im talking about even if i move it from my desk top to my program files to pictures no matter where it is the program will always delete its self and the folder it is in the reason i need it to do that is because i use teamviewer and i bring over stuff that i dont want to leave on that computer and if i can just press a simple button and poof its all gone then that would be great ppl are saying i should use bat file to do that and honestly idk how to code bat files
-
Apr 14th, 2012, 05:51 AM
#7
Re: deleting a directory
 Originally Posted by tekatsu
ya i need it to delete its self and the folder it is in no matter where it is on the computer im talking about even if i move it from my desk top to my program files to pictures no matter where it is the program will always delete its self and the folder it is in the reason i need it to do that is because i use teamviewer and i bring over stuff that i dont want to leave on that computer and if i can just press a simple button and poof its all gone then that would be great ppl are saying i should use bat file to do that and honestly idk how to code bat files
1. You cannot delete an executable in use
2. The user could always use the restore feature of the recycle bin.
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
|