Next: , Previous: , Up: file commands   [Contents][Index]


6.2.6 Removing files and directories

Files removal is forced: the --force option to rm is always used. It is responsibility of the caller to validate the operation before invoking these functions.

Some functions test the existence of the pathname before attempting to remove it: this is done only if test execution is disabled; if test execution is enabled the command line is echoed to stderr to make it easier to debug scripts.

Function: mbfl_file_enable_remove

Declare the commands required to remove files and directories. Declaring the intention to use a program

The programs are: rm, rmdir.

Function: mbfl_file_remove pathname

Remove pathname, no matter if it is a file or directory. If it is a directory: descend the sub-levels removing all of them. If an error occurs return 1.

Function: mbfl_file_remove_file pathname

Remove the file or symbolic link selected by pathname. If the file does not exist or it is not a file or an error occurs: return 1.

Function: mbfl_file_remove_symlink pathname

Remove the symbolic link selected by pathname. If the link does not exist or it is not a symbolic link or an error occurs: return 1.

Function: mbfl_file_remove_file_or_symlink pathname

Remove the file or symbolic link selected by pathname. If the file does not exist or it is not a file or an error occurs: return 1.

Function: mbfl_file_remove_directory pathname

Remove the directory selected by pathname. If the directory does not exist or an error occurs: return 1.

Function: mbfl_file_remove_directory_silently pathname

Like mbfl_file_remove_directory(), but do not print messages if the directory is not empty.


Next: , Previous: , Up: file commands   [Contents][Index]

This document describes version 3.0.0-devel.0 of Marcos Bash Functions Library.