Handles file operations, including creating, searching, setting permissions and removing files.
Append row to file
Cat a file
Cat file
Set file permissions
chmod file or directory.
Change owner recursively
chown -r directory.
Copy a file
Copies a file within same system.
This does not copy file from or to a
remote system, use /cat/ and /pipewrite/
for that.
Get the checksum of the metadata of a directory, recursively
Checksum the current state of a directory and print it to stdout
Get the checksum of the file contents of a directory, recursively
Checksum the current contents of a directory and print it to stdout
Check so a directory path does exist
If the directory does not exist, exit with error.
Check so that a directory path does not exist
If the directory does exist, exit with error.
Check so a file path does exist
If the file does not exist, exit with error.
Check so a file path does not exist
If the file does exist, exit with error.
Get recursive list of permissions
Grep file for pattern
Grep and match count
Grep a file against pattern and expect the given count
to match by an operator or else exit with error, as:
matched -operator count
List a file
List one or more files.
Create a directory path
mkdir -p.
Append to a file from stdin
Write data to file read from stdin
Retrieves the file or directory absolute path
Figures out the absolute path of a given file or directory. It follows "..", but does not resolve symlinks.
Restore list of permissions
Take a string of permission retrieved from
/getpermissions/ and restore them from within
the base directory.
Forcefully remove a file or directory recursively
rm -rf a directory.
Check if a row exists in a file
Look in the file and see if the row exists there,
if not exit with error.
Set exist to 0 to invert the exit status.
Make sure that a specific row exists in a file
Look in the file if the row does already exist,
if not append it to the file.
Sed a pattern in place
Display file status
stat -c.
Touch a file
Check for module dependencies
- non-zero on failure
Recursively remove a directory path
- $1: list of directories
- 0: success
- 1: failed removing directory
Creates a directory path
- $1: list of directories
- 0: success
- 1: failure creating directory path
Set file permissions
- $1: permission (octal)
- $2: file path
- 0: success
- 1: failed to set permissions
Change file owner
- $1: owner name
- $2: file path
- 0: success
- 1: failed to change owner
Recursively change directory owner
- $1: owner name
- $2: directory path
- 0: success
- 1: failed to change owner
Check if directory path exists
- $1: list of directories
- 0: successfully found all directories
- 1: failed to find one or more directories
Check if directory path does not exist
- $1: list of directories
- 0: no directories found
- 1: found one or more directories
Check if a given file path exists
- $1: list of files
- 0: successfully found all files
- 1: unable to find one of the files
Check if a given file path does not exist
- $1: list of files
- 0: none of the files provided were found
- 1: one of the files exist
Touch a file
- $1: list of files
- 0: success
- 1: failed
Cat file
- $1: file
- Non-zero on error.
List files
- $1: list of arguments
- Non-zero on error. POSIX ls return values. See also:
man ls
Copy a file within the same OS.
- $1: source to copy from
- $2: destination to copy to
- Non-zero on error. POSIX cp return values. See also:
man cp
Check if a specific row exist or not in a text file.
- $1: row data to check from
- $2: file to check
- $3: exist flag
- 0: success
- 1: row does not exist
- 2: file not found
Make sure a specific row exist in a text file,
creates the file if it's missing.
- $1: row data to persist.
- $2: file to check
- 0: success
- 1: could not write to file
Remove all occurrences of a specific row from a text file.
- $1: row data to have removed
- $2: file to remove from
- 0: success
- 1: could not write to file
Grep on file.
Possibly require exact count matches,
then also a comparison operator could be provided, default is "eq".
- $1: pattern
- $2: file path
- $3: count to match, if not provided then
- the matched rows are printed.
- $4: operator to compare count matches by. Default: "eq"
- 0: success
- 1: failed to match pattern or failed to match count
- 2: file not found
Sed a pattern in place
- $1: pattern
- $2: file path
- 0: success
- 1: failed access file or failed to write to file
Append a row to a text file.
- $1: row data
- $2: file path
- 0: success
- 1: failed writing to file
Write to a file from stdin
- $1: file path
- 0: success
- 1: failed writing to file
Append to a file from stdin
- $1: file path
- 0: success
- 1: failed writing to file
Get a list of directory and file permissions
which could be stored and used later for restoring permissions.
- $1: file or directory path
- Text output on stdout.
Restore permissions.
- $1: base directory path
- $2: permissions
- 0: success
- 1: failed to chown or failed to chmod
Display file status
- $1: file path
- 0: success
- 1: failure
Calculate the checksum of a directories recursive metadata (dates, sizes, etc) to be
able to notice when any file has changed.
- $1: dir path
- 0: success
- 1: failure if there is not checksum tool available.
Calculate the checksum of a directories recursive content.
- $1: dir path
- 0: success
- Text output on stdout.
- 1: failure if there is not checksum tool available.
Figure out a file/dir's absolute path, it follows ".." but does not resolve symlinks.
The file/dir does not have to exist.
- $1: file path (relative or not)
- 0: success
- Text output on stdout.
- 1: failure if there is not checksum tool available.
Helper function when using auto completion on files.