DeleteDir dir$
Parameters
| dir$ - path and name of the directory to delete |
Description
|
Deletes an empty directory. DeleteDir only removes directories that are completely empty - if there are any files or subfolders inside, nothing happens and no error is raised. To remove a folder with contents, delete the files first (walk them with ReadDir/NextFile$ and DeleteFile), then delete the folder itself. Do not put a trailing slash on the path. Because failure is silent, check the result with FileType: it returns 0 once the directory is gone, 2 if it is still there. See also: CreateDir, DeleteFile, FileType, ReadDir. |
Example
; DeleteDir Example ; ----------------- ; Create an empty demo folder so there is something safe to delete CreateDir "demo_folder" Print "Created demo_folder (FileType = "+FileType("demo_folder")+")" ; DeleteDir removes a folder - it must be EMPTY, no trailing slash DeleteDir "demo_folder" Print "Deleted demo_folder (FileType = "+FileType("demo_folder")+")" Print "" Print "FileType 2 = directory, 0 = gone" Print "" Print "Press any key to close the example" WaitKey End
Index