|
-
Jul 30th, 2000, 05:23 AM
#1
Thread Starter
Hyperactive Member
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?
-
Jul 30th, 2000, 05:39 AM
#2
Lively Member
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
"Innovate, don't immitate."
-
Jul 30th, 2000, 05:44 AM
#3
Thread Starter
Hyperactive Member
-
Jul 30th, 2000, 05:12 PM
#4
Thread Starter
Hyperactive Member
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...
-
Jul 30th, 2000, 05:49 PM
#5
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!
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
|