-
Can I not delete a directory using the kill command?
Code:
Kill ("C:\Windows\Desktop\Myfolder\")
I have also tried
Code:
Kill ("C:\Windows\Desktop\Myfolder")
and
Code:
Kill "C:\Windows\Desktop\Myfolder"
and
Code:
Kill "C:\Windows\Desktop\Myfolder\"
none work...which one am I missing?
-
Try this...
To create a folder you use the MKDir function:
Code:
'Create a folder
MkDir "C:\MyFolder"
To delete a folder, use the RmDir function:
Code:
'Delete a folder
RmDir "C:\MyFolder"
When creating a directory, if the directory all ready exists, then you will get an error. If you try to delete a folder that contains files, or sub-directories with files, then an error will also occur.
Hope you know what I mean. Use the kill method for files only.
Laterz
REM
-
-
For some reason it will not delete the folder, I am thinking its because there are files in it...so I tried to kill the files before but
kill "c:\myprogram\*.*"
Doesnt work...
-
If you're using VB6 then set a reference to the Microsoft Scripting Runtime. Declare a FileSystemObject and call the DeleteFolder method. This method deletes a folder even if it contain files.
Code:
Private Sub KillFolder(sPath as String, Optional blnForce As Boolean)
Dim fso As FileSystemObject
Set fso = New FileSystemObject
fso.DeleteFolder sPath, blnForce
End Sub
The blnForce value forces a delete even if the folder is ReadOnly.
Good luck!