Created
August 20, 2012 13:39
-
-
Save Chavao/3404153 to your computer and use it in GitHub Desktop.
Elimina os arquivos com mais de 3 dias
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 | |
| # | |
| # Elimina os arquivos com mais de 3 dias; | |
| # | |
| for d in /home/chavao/Desktop/temp; do | |
| find $d -type f -mtime +3 -exec rm --force "{}" \; | |
| # | |
| # Removemos os diretóios vazios | |
| # | |
| find $d/* -type d -print0 | \ | |
| sort --zero-terminated --reverse | \ | |
| xargs --no-run-if-empty --null --max-args 1 rmdir 2> /dev/null | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment