redundant-file-optimizer (RFO)
A CLI utility to conserve space in directories by reusing underlying file objects across duplicate files.
Installation
The latest build of this project can be found attached to releases on the Releases page.
Usage
NAME:
   redundant-file-optimizer - Optimize redundant files using symbolic links.
USAGE:
   redundant-file-optimizer [global options] command [command options]
VERSION:
   dev
COMMANDS:
   optimize  Optimize the files under the given directory.
   restore   Restore an optimized directory to an unoptimized state.
   copy, cp  Copy an optimized directory to a new path.
   help, h   Shows a list of commands or help for one command
GLOBAL OPTIONS:
   --log-level value, -l value  The minimum level of logs to display. (default: "warn")
   --help, -h                   show help
   --version, -v                print the version
Optimizing a Directory
NOTE: Because hard linking shares the underlying INode, links to shared files will all be given the same permissions.
redundant-file-optimizer optimize - Optimize the files under the given directory.
USAGE:
   redundant-file-optimizer optimize [command options]
OPTIONS:
   --directory value, -d value                                              The directory to optimize files under.
   --include-pattern value, -i value [ --include-pattern value, -i value ]  Regex patterns matching files to explicitly include in this operation. If defined, all non-matching files will be excluded.
   --exclude-pattern value, -e value [ --exclude-pattern value, -e value ]  Regex patterns matching files to explicitly exclude from this operation.
   --parallel-limit value, -p value                                         The maximum number of concurrent operations that can run at a time. (default: 8)
   --no-cache, -c                                                           Whether the file cache should be ignored when building the file hash table. (default: false)
   --help, -h                                                               show help
Restoring a Directory
NAME:
   redundant-file-optimizer restore - Restore an optimized directory to an unoptimized state.
USAGE:
   redundant-file-optimizer restore [command options]
OPTIONS:
   --directory value, -d value       The directory to run this operation against.
   --parallel-limit value, -p value  The maximum number of concurrent operations that can run at a time. (default: 8)
   --help, -h                        show help
Copying an Optimized Directory
NAME:
   redundant-file-optimizer copy - Copy an optimized directory to a new path.
USAGE:
   redundant-file-optimizer copy [command options]
OPTIONS:
   --parallel-limit value, -p value  The maximum number of concurrent operations that can run at a time. (default: 8)
   --from value, -i value            The path of the optimized directory to copy.
   --to value, -o value              The path to copy the optimized directory to.
   --help, -h                        show help
Examples
Optimize all files under the my-files directory:
redundant-file-optimizer optimize -d my-files
Optimize all files under the current directory whose path contains the string data:
redundant-file-optimizer optimize -i '.*data.*' -d .
Restore all files under the current directory:
redundant-file-optimizer restore -d .
Copy the optimized directory at /old to a new optimized directory at /mnt/mymount/new:
redundant-file-optimizer copy -i /old -o /mnt/mymount/new