Command-line tools#
shelephant_dump#
Dump filenames to a YAML-file.
Note
One has to choose how to store the filenames in the YAML-file:
Default: filenames are made relative to the
--root
and normalised.--abspath
: make all paths absolute.--raw
: turn off normalisation.
Note
If you have too many arguments you can hit the pipe-limit. In that case, use xargs
:
find . -name "*.py" | xargs shelephant_dump -o dump.yaml
or you can use --command
such that shelephant executes the command for you:
shelephant_dump -o dump.yaml --command find . -name '*.py'
Note
If you have search pattern you can store it in a YAML-file:
# search.yaml
search:
- rglob: '*.h5'
- rglob: '*.yaml'
and use it as follows:
shelephant_dump -o dump.yaml --search search.yaml
Note that the search pattern is executed in the directory of the YAML-file and all paths are stored relative to the YAML-file.
usage: shelephant_dump [-h] [-o Path] [--search Path] [-a] [-i] [-e str]
[-E str] [-k str] [--fmt str] [-c] [--cwd str] [--raw]
[--abspath] [--root str] [-s] [-f] [-v] [--all] [-r]
[str ...]
Positional Arguments#
- files
Filenames
Named Arguments#
- -o, --output
Output YAML-file.
Default: shelephant_dump.yaml
- --search
Read search-patterns from YAML-file
- -a, --append
Append existing file
Default: False
- -i, --info
Add information (sha256, size)
Default: False
- -e, --exclude
Exclude input matching this pattern
- -E, --exclude-extension
Exclude input with this extension (e.g. “.bak”)
Default: []
- -k, --keep
Keep only input matching this regex
- --fmt
Formatter of each line, e.g.
"mycmd {}"
- -c, --command
Interpret arguments as a command (instead of as filenames) an run it
Default: False
- --cwd
Directory to run
--command
- --raw
No path-normalisation of input
Default: False
- --abspath
Store as absolute paths
Default: False
- --root
Root for relative paths (default: directory of output file)
- -s, --sort
Sort output
Default: False
- -f, --force
Overwrite output file without prompt
Default: False
- -v, --version
- --all
Dump all files in the working directory
Default: False
- -r, --recursive
Recursively dump files (implies –all)
Default: False
shelephant_hostinfo#
Collect information about a remote directory (on a remote SSH host).
This information is stored in a YAML-file (default: shelephant_hostinfo.yaml
):
root: <path> # relative to the YAML-file, or absolute
ssh: <user@host> # (optional) remote SSH host
dump: <dump> # (optional, excludes "search") yaml-file to read list of files from
search: # (optional, excludes "dump") search information, must be set by hand
- ...
files: # (optional) list of files (from "search" / "dump", or set by hand)
- ...
Usage:
Create hostinfo:
# set "root" shelephant_hostinfo <path> # set "root" and "ssh" shelephant_hostinfo <path> --ssh <user@host> # set "root" (and "ssh") and "dump", and update "files" shelephant_hostinfo <path> --dump [shelephant_dump.yaml] shelephant_hostinfo <path> --dump [shelephant_dump.yaml] --ssh <user@host>
Update hostinfo (update “files”):
# update "files" based on "dump" or "search" shelephant_hostinfo --update [shelephant_hostinfo.yaml]
usage: shelephant_hostinfo [-h] [-o Path] [-d [Path]] [--ssh str] [-u] [-i]
[-f] [--verbose] [--version]
Path
Positional Arguments#
- path
Path to remote directory.
Named Arguments#
- -o, --output
Output YAML-file.
Default: shelephant_hostinfo.yaml
- -d, --dump
YAML-file containing a list of files.
- --ssh
Remote SSH host (e.g. user@host).
- -u, --update
Update “files” based on “dump” or “search”.
Default: False
- -i, --info
Add information (sha256, size).
Default: False
- -f, --force
Force overwrite output.
Default: False
- --verbose
Print commands (only SSH remote).
Default: False
- --version
show program’s version number and exit
shelephant_cp#
Copy files listed in a (field of a) YAML-file. These filenames are assumed either relative to the YAML-file or absolute.
Usage:
shelephant_cp <sourceinfo.yaml> <dest_dirname>
shelephant_cp <sourceinfo.yaml> <dest_dirname_on_host> --ssh <user@host>
shelephant_cp <sourceinfo.yaml> <destinfo.yaml>
Note
Files that are marked as equal are not touched.
usage: shelephant_cp [-h] [--ssh str] [--colors str] [--mode str] [-f] [-q]
[-n] [-v] [--ignore-prefix] [--verbose]
Path Path
Positional Arguments#
- source
Source information.
- dest
Destination directory/information.
Named Arguments#
- --ssh
SSH destination (e.g. user@host).
- --colors
Color scheme [none, dark].
Default: “dark”
- --mode
Use ‘sha256’, ‘rsync’, and/or ‘basic’ to compare files.
Default: “sha256,basic”
- -f, --force
Overwrite without prompt.
Default: False
- -q, --quiet
Do not print progress.
Default: False
- -n, --dry-run
Print copy-plan and exit.
Default: False
- -v, --version
show program’s version number and exit
- --ignore-prefix
Ignore prefix in source/dest
Default: False
- --verbose
Verbose commands.
Default: False
shelephant_mv#
Move files listed in a (field of a) YAML-file. These filenames are assumed either relative to the YAML-file or absolute.
Usage:
shelephant_mv <sourceinfo.yaml> <dest_dirname>
usage: shelephant_mv [-h] [--colors str] [-f] [-q] [-n] [-v] Path Path
Positional Arguments#
- source
Source information.
- dest
Destination directory.
Named Arguments#
- --colors
Color scheme [none, dark].
Default: “dark”
- -f, --force
Overwrite without prompt.
Default: False
- -q, --quiet
Do not print progress.
Default: False
- -n, --dry-run
Print copy-plan and exit.
Default: False
- -v, --version
show program’s version number and exit
shelephant_rm#
Remove files listed in a (field of a) YAML-file. These filenames are assumed either relative to the YAML-file or absolute.
Usage:
shelephant_rm <sourceinfo.yaml>
usage: shelephant_rm [-h] [-f] [-q] [-n] [--verbose] [-v] Path
Positional Arguments#
- source
Source information.
Named Arguments#
- -f, --force
Remove without prompt.
Default: False
- -q, --quiet
Do not print progress.
Default: False
- -n, --dry-run
Print copy-plan and exit.
Default: False
- --verbose
Print commands (only SSH remote).
Default: False
- -v, --version
show program’s version number and exit
shelephant_diff#
usage: shelephant_diff [-h] [--ssh str] [--colors str] [--mode str]
[--sort str] [--table str] [--filter str] [-o Path]
[-f] [--version]
Path Path
Positional Arguments#
- source
Source information.
- dest
Destination directory/information.
Named Arguments#
- --ssh
SSH destination (e.g. user@host).
- --colors
Color scheme [none, dark].
Default: “dark”
- --mode
Use ‘sha256’, ‘rsync’, or ‘basic’.
Default: “sha256”
- --sort
Sort printed table by column.
- --table
Select print style.
Default: “SINGLE_BORDER”
- --filter
Filter to direction (separated by ‘,’).
- -o, --output
Dump as YAML file.
- -f, --force
Force overwrite output.
Default: False
- --version
show program’s version number and exit
shelephant_parse#
Parse a YAML-file, and print to screen.
usage: shelephant_parse [-h] [-v] Path
Positional Arguments#
- file
File path.
Named Arguments#
- -v, --version
show program’s version number and exit