remove_directory

Definition: bool res = remove_directory(string dir_name, bool force=false)
Description: Remove a directory.

dir_name: the directory to remove.
force: if true (1) this will also remove files and sub-directories in the directory. The default is false (0), which means that it will only remove the directory if it is already empty.

Returns: false (0) on failure, true (1) on success.
Comments: Unlike some other routines here, any path separators should be appropriate for the operating system, namely backslash ('\\') on Windows and forwardslash ('/') on Linux.

A trailing slash is optional, it makes no difference whether one is present or not.

The use of a named parameter when setting the force flag is recommended, to make the intent clear and the code easier to read.
Example:
if not remove_directory("the_old_folder") then
    crash("Filesystem problem - could not remove the old folder")
end if
See Also: create_directory, chdir, clear_directory