remove_dir(+quoted_atom)

This built-in predicate removes a directory. If the argument specifies an existing directory that was successfully deleted then the predicate is exited else it fails. The directory to remove must be empty and not the current working directory or the root directory.

see also: app_dir/1 base64_decode_file/2 base64_encode_file/2 compress_file/2 copy_file/2 current_dir/1 decompress_file/1 decompress_file/2 decrypt_file/3 delete_file/1 encrypt_file/3 exists_dir/1 exists_file/1 info_file/2 make_dir/1 md5_file/2 next_file/2 next_file/3 next_dir/2 rename_file/2 set_current_dir/1 split_fn/2 unlink_file/1 wipe_file/1

Examples
remove_dir('c:\\documents\\mydocs\'). If the specified file exists and unlinking the file was successful then the predicate is exited, else it fails.

 

Exceptions
The argument is an empty variable an instantiation_error exception is thrown
The argument Arg is not an atom enclosed by single or double quotes a type_error(atom_singlequotes, Arg) exception is thrown
The directory Dir to remove is not empty a system_error(not_empty, directory, Dir) exception is thrown
No permission to remove the directory Dir a permission_error(remove, directory, Dir) exception is thrown
The directory Dir to remove does not exist a existence_error(directory, Dir) exception is thrown
The directory Dir could not be removed a system_error(remove, directory, Dir) exception is thrown

 

 

info@trinc-prolog.com