Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Delete Directory Command

Author
Message
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 4th Sep 2007 07:41
Has anyone ever had any problems with the delete directory command? In one of my programs I used a temporary directory to store files and have to delete it later on but it doesn't delete. All the files within the directory are erased but the folder is still there. There were two other inquiries about this a long time ago but neither of the posts had any answers. The commands seems to work if the directory I want to delete is saved directly in the C drive: "C:/dir", but otherwise, nothing.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Sep 2007 10:07
The most likely problems are that the directory you specified doesn't exist because of the current directory, or the directory is in use.

A quick test is to add a debug call on the line just before the Delete:

Gosub Debug

At the end of your procedures add this:



When you run the program, at the point you would have deleted the directory, the program will stop and print the name of the directory it thinks it will be deleting, followed by the contents of the current directory.

Check in Windows Explorer that the directory name that was printed actually exists.

If you don't use the full path, but instead use a relative path (or no path, just the directory name), then the folder name should appear on the DIR list.

With this you should be able to figure out what's going on.

The Debug procedure method can be used to find many problems by altering the information that gets printed when the procedure is called.

TDK_Man

luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 4th Sep 2007 17:32
Quote: "The most likely problems are that the directory you specified doesn't exist because of the current directory, or the directory is in use."


Thanks, but I've checked this and the directory is not in use when I try to delete it. And I know that the directory exists and the file path is right. When I try to delete the directory, all the files in the dir are cleared but the directory still exists. I tried with the DarkBasic example 15 or whichever one uses the clear dir command, and if the directory wasn't created right on the hard drive it wouldn't delete afterwards.

Login to post a reply

Server time is: 2025-06-02 07:09:09
Your offset time is: 2025-06-02 07:09:09