Last active
August 15, 2016 12:23
-
-
Save Gigabiter/5601a489aab2385c73a9ee249955a868 to your computer and use it in GitHub Desktop.
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 | |
string1=$1 | |
string2=$(du -s $1 | awk '{print($1)}') | |
maxSize=$2 | |
echo "Размер дирктории $string2" | |
if (("$string2" > "$maxSize")) | |
then | |
echo "Удаляем папку $string1" | |
rm -r -f "$string1" | |
else | |
echo 'Директория имеет нормальный размер' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
вызов с параметрами sh cleaner.sh /path/to/dir 100000
$1 - путь к директории
$2 - максимальный размер папки