Last active
February 29, 2016 17:02
-
-
Save dcode/d101ee12ab7b0127e30c to your computer and use it in GitHub Desktop.
I use this to archive an entire directory (by subdirectory) and compress with 7zip. I run this occasionally on my "projects" dir to cleanup old space.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for item in $(find . -type d -depth 1 | grep -Ev 'dir|names|toexclude'); do | |
| tar cvf - ${item} | 7za a -si ${item}.tar.7z; | |
| rm -rf ${item}; | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for item in $(find . -type f -depth 1 -name '*.tar.7z' | grep -Ev 'names|to|exclude'); do | |
| 7za x -so ${item} | tar xf -; | |
| rm -f ${item}; | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment