$file_find_opts[]
Passed to find(1) when called by file_find.
$file_find_sort
If set to true, output from file_find() will be sorted.
$file_hashbin
Name of default hashing program
$file_hash_texts[]
Hashing algorithm output (see file_hash()).
$file_hash_name[]
Hashed file names (see file_hash()).
$file_hash_sizes[]
Hashed file sizes (see file_hash()).
$file_hash_modes[]
Hashed file modes (see file_hash()).
file_read()
Reads file ($2) into an array variable ($1)
file_read_func()
Reads file ($1) and calls a command ($@) with lines as its arguments.
$1 - File name
$@ - Command to receive the file contents as arguments
file_capture_func()
Capture the output of a command ($@) to a temporary file, storing the name of the file in a named variable ($1).
$1 - Name of variable to receive the name of the temporary file.
$2 - Command to execute
$@ - Command arguments (optional)
file_capture()
Captures stdin to a temporary file, storing the name of the file in a named variable ($1).
$1 - Name of variable to receive the name of the temporary file.
file_var_func()
Captures the output of a command ($@) and assigns its output to the given variable ($1).
$1 - Name of variable to receive output from the command.
$2 - Command to execute
$@ - Command arguments (optional)
file_array_func()
Captures the output of a command ($@) and assigns its output to the given array variable ($1).
$1 - Name of array variable to receive lines from the command.
$2 - Command to execute
$@ - Command arguments (optional)
run_mkdir()
Wraps mkdir -p. This function should be used instead of the bare command in most cases.
run_pushd()
Wraps pushd to be silent or report a useful error
run_popd()
Wraps popd to be silent
run_in_dir()
Runs the command ($@) after changing a new directory ($1).
$1 - New directory
$@ - Command to run
file_readdir()
Prints list of files in the given directory ($1).
$1 - Directory to search
$@ - Optional arguments
file_mkdir()
Creates directory portion of file name ($1).
file_find
Fills an array with names of things found by find(1). The $file_find_opts[] variable controls the behavior of this function, allowing additional arguments to be passed to find.
$1 - Name of array variable
$@ - Path names to search
file_size()
Prints the size of the given file(s)
$@ - File names
file_test()
Performs a existential test ($1) on the given files ($@) using the test shell command.
file_is_terminal()
Returns success if the named fd ($1) is a terminal.
file_hash_raw()
Runs the $file_hashbin program on the given files ($@).
file_hash_list()
Runs file_hash_raw() on the given files ($@) and reads the results in the named array variable ($1).
file_hash()
Loads the hash information for the given files ($@) into the file_hash_* arrays
_file_hash_split()
Splits apart the hash results ($1) for a single file and appends the various pieces to the respective $file_hash_*[] arrays.
remove mode from name
file_hash_print()
Prints the stored hash information. This function exists primarily for verification purposes.
_file_hash_print_index()
Prints stored hash information for a single file.
$1 - Index into $file_hash_*[] arrays
file_duplicate_scan()
Scans the provided paths ($@) for duplicate files.
_file_duplicate_scan_index()
Checks an individual file for duplicity.
_file_duplicate_scan_check()
Prints the full list of duplicate files. The first of a group of duplicates files is prefixed with -; the remaining duplicates in the group are prefixed with +.
file_duplicate_scan_list()
Calls file_duplicate_scan "$@" and stores the results in an array variable ($1).
for_each_file_duplicate()
Iterates through a list of duplicates, as produced by file_duplicate_scan_list(). For each duplicate, a given function ($1) will be called with two arguments: the original and duplicate file names.
file_duplicate_symlink()
Finds all duplicates and eliminates them by replacing them with symbolic links.
file_duplicate_link()
Finds all duplicates and eliminates them by replacing them with links.
file_duplicate_delete()
Finds duplicates and deletes them.