Skip to content

Instantly share code, notes, and snippets.

@jotapepinheiro
Forked from icaoberg/zipfolders.sh
Last active December 3, 2015 00:29
Show Gist options
  • Save jotapepinheiro/956c5d8ef7d30934cb04 to your computer and use it in GitHub Desktop.
Save jotapepinheiro/956c5d8ef7d30934cb04 to your computer and use it in GitHub Desktop.
Compactar pastas .sh
#!/bin/sh
# Corrigir /bin/sh^m bad interpreter no such file or directory
# dos2unix *.sh
cd /home/proja380/public_html/wp-content/uploads/
caminho=2012
echo 'Compactando pasta '$caminho;
# http://www.tutorialspoint.com/unix_commands/tar.htm
find $caminho -maxdepth 1 -mindepth 1 -type d | while read f; do tar -Pzcf "$f.tar.gz" "$f" | echo "$f.tar.gz OK"; done; exit;
# cd /home/admin/web/projac.com.br/public_html/wp-content/2012
# wget http://1.1.1.1/~proja380/wp-content/uploads/2012/06.tar;
# DESCOMPACTAR
# for i in `find . -name '*.tar.gz'`; do tar -xzf `dirname$i` $i; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment