-
Notifications
You must be signed in to change notification settings - Fork 0
Command line Options
This page contains in-depth explanations of how the command-line arguments work, and how to use them.
The SOURCE and TARGET arguments make up the base of all Sortery functionality, and are thus required. They are the two directories used in sorting. It depends on the arguments/flags you use, but generally, SOURCE is where the files-to-be-sorted are contained, and TARGET is the directory into which files are sorted. If either of SOURCE or TARGET is a path that doesn't exist, Sortery will print an error message for each path and exit without executing the sort.
The config file argument takes a path to a json file of a specific format, to be used instead of the usual arguments passed to the sort subcommand. The SOURCE and TARGET arguments are still required when using config-file, as they are not included in the JSON config file. Here is a usage example:
sortery source/ target/ --config-file="/home/user/config.json"
For information on the JSON config file format, see the JSON config page.
Note that this option overrides the sort command, meaning that if config-file is passed, the sort command doesn't effect the sorting.
The dry-run flag runs the sorting algorithm without actually sorting, and outputs the intended sort for each file so the user can preview the sort. The output for each file will look like:
Sorting /path/to/old/file to /path/to/new/file.
The old path will be green, and the new path will be red.
The extract flag tells Sortery to move everything from SOURCE into TARGET, while maintaining subdirectory structure. For example: we have a directory with a structure that looks like this:
source/
source/
- target/
- - file4
- file1
- file2
- file3
If we want to move everything from source/ to target/, we would use the extract flag:
sortery -e source/ target/
Sortery automatically detects if TARGET is inside SOURCE, and if it is, does not sort it. Now, source/ should look like this:
source/
source/
- target/
- - file4
- - file1
- - file2
- - file3
The sort command has replaced the sort-by-date flag, and supports more advanced options, which you can read about on the sort command page. Basic usage still applies when using it; you must pass the SOURCE and TARGET arguments to sortery. Here is the most basic sort command:
sortery /home/user/dir1 /home/user/dir2 sort
This does the same thing as the old sort-by-date flag; it sorts the files into year and month directories, renaming them according to their creation date in the format yyyy-mm-dd HHhMMmSSs, and adding sequential numbers to files whose names are already taken by other files.