Remove all matching lines from a file.
> file_remove_matching_lines_from_file "file_name" "regex"
Return true if file is binary, false if not.
> file_is_binary "file"
Modifies file by removing matching lines. file_modify_remove_lines “file” “regex”
Return true if a file is executable.
> file_is_executable "file"
Return the file extension to the best of our ability.
> file_get_ext "file"
Return the file root name (strips path and extension).
> file_get_file_root_name [-stdin] | "file"
Throw file not found error and return true if file is not found.
> file_raise_file_not_found "file"
Throw error and return true if directory is not found.
> file_raise_dir_not_found "directory"
Return true if a directory is writable.
> file_is_dir_writable "directory"
Throw error and return true if directory is not writable.
Throw error and return true if
file is not the complete path to file.
> file_raise_is_not_full_path "file"
Throws error and returns true if it appears the file includes the path.
> file_raise_is_path "file"
Return true if a file has been modified since last time checked. New files return false.
> file_has_been_modified "file"
> file_create_file_of_size "file" bytes
Return the owner of a file. Also reads file names from standard input.
> file_get_owner "file"
Joins path strings together and returns a single path.
> file_join_path "string1" "string2" ...
Return the number of lines in a file.
> file_line_count "file"
Return full path from relative path if possible. Must be able to ‘cd’ to the dir.
> file_realpath "file"
Return true if the provided file path is full path to the file.
> file_is_full_path "file"
Return true if diff command returns zero lines.
> file_are_files_same "file1" "file2"
Returns file modified time in Unix epoch seconds.
> file_modified_time "file_name"
Returns number of seconds since file was last modified.
> file_seconds_since_modified "file_name"
Return true if directory is empty.
> file_is_empty_dir "directory"
Try to make a directory and return false if unable.
> file_try_mkdir "directory"
Return files in a directory. Does not include subdirectories.
> file_list_files [-l|-a] "directory" # -l: List full path to file. # -a: List all attributes.
List directory names, not full paths, from specified or current directory.
> file_list_dirs "directory"
Return true if the directory exists.
> file_is_dir "directory"
Returns size of directory contents in kilobytes.
Errors are suppressed to account for busy directories. If you lack correct perms size may not be accurate.
> file_get_dir_kb_size "directory"
Read kilobytes from input and return megabytes.
> file_get_mb_from_kb [-stdin]
Get dir size, returns mbytes.
> file_get_dir_mb_size "directory"
Return file size in bytes.
> file_get_size "file"
Return the number of files from defined or current directory.
> file_get_file_count "directory"
Return true if file is zero bytes or contains only blank lines.
> file_is_empty "file"
Return true if file exists.
> file_exists "file"