Directory Archiver (dir-archiver)
Archive directory having the given depth from a given directory.
TL;DR: dir-archiver --input-dir ~/projects --depth 2 --sep "__" -output-dir ~/archives --commit
Installation
# Install the gem
gem install dir-archiver
# refresh your gem just in case
rbenv rehash
# Get list of options just type the name of the gem
github_archiver
You should see something like
Usage: dir-archiver [options]
Specific options:
-i, --input-dir INPUT_DIR where INPUT_DIR is starting directory
If not specified, current directory will be used
-d, --depth NUMBER where NUMBER is depth of the directory from the starting directory
If not specified, 1 will be used
-s, --seperator [SEP] The seperator string to be used
If not specified, '__' will be used
-o, --output-dir OUTPUT_DIR where OUTPUT_DIR is output directory
If not specified, current directory will be used
-c, --[no-]commit Commit your action
default to --no-commit e.g. dry-run only
Common options:
-h, --help Show this message
Example Usage:
a) archive all immediate directories from the given directory (default to 1 level)
$cd ~/inputs/projects
$dir-archiver --commit
b) archive all directory 2 level depth (dry-run)
$dir-archiver -i ~/inputs/projects -d 2 -s '__' -o ~/outputs/archives
c) archive all directory 2 level depth (commit action)
$dir-archiver -i ~/inputs/projects -d 2 -s '__' -o ~/outputs/archives
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request