-
October 28th, 2004, 09:29 AM
#1
A VB6 problem and strange thing
Hello, I am using WinXP Home. I am creating an application in VB6 and this is my problem:
There is an sample folder with a file that I created.
Let it be C:\folder\file.txt
Then I run the command
kill ("C:\folder\file.txt")
followed by
rmdir(C:\folder)
The problem is that only the file is removed, the folder stays there. Also why is that all the folders in my computer is set to read-only attribute (when I check the properties of the folder, the Read-only attribute is checked and the box "appeared" to be disabled althought not).
Then I code another app with only the rmdir command and it did remove the directory.
Can anyone help me out...
-
October 28th, 2004, 11:01 AM
#2
Hi,
works perfictly fine for me .................what is the error message you are getting ?.......and are you sure the folder is empty?
I had like 5 -6 txt files in this test123 folder and this code delete all the files then the folder itse;f
Private Sub Command1_Click()
Kill ("C:\test123\*.txt")
RmDir ("c:\test123")
End Sub
-
October 28th, 2004, 11:23 AM
#3
Opps. I forgot to say that I have set the attributes of the file to Read-only, and the folder to all 4 attributes using setattr. Then when I want to remove the file and the folder, I first use setattr "C:\folder\file.txt", vbnormal followed by setattr "C:\folder\file.txt", vbnormal. Then I kill the file and remove the folder. The folder is named such that it include an "extension", such as folder.exe
There is no other files in the folder other than the one that I already issued the kill command.
There is an error while it is trying to remove the folder: Path/File access error
After this error occured, the file is removed (which is correct), but the folder is still there when I checked...
-
November 1st, 2004, 03:30 PM
#4
I found a fix to my own problem :P
After I "kill" the file, I use a do while loop...
Do While Dir$(path of the file inside the folder) = vbNullString
RmDir (folder path)
Exit Do
Loop
Strangely, after I added this loop it solved my problem.
-
February 4th, 2005, 08:32 PM
#5
Junior Member
-
February 4th, 2005, 08:36 PM
#6
Junior Member
did u buy your copy of vb6, if u didnt plz can u tell me where u got it from, im desperate 2 try it. I have.
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
|
|