Created
February 1, 2020 21:59
-
-
Save Blaumaus/17b85ef3fb4285b890a2771df4fcd757 to your computer and use it in GitHub Desktop.
A script to remove all the screenshots in ~/Pictures/ directory
This file contains 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
#!/usr/bin/bash | |
# A script to remove all the screenshots in ~/Pictures/ directory | |
if [[ `ls ~/Pictures/ | grep "Screenshot\ from" | wc -l` -gt 0 ]]; then | |
before_size=`du -shb ~/Pictures | cut -f1` | |
echo "`rm -v ~/Pictures/Screenshot\ from*.png | wc -l` screenshots deleted!" | |
after_size=`du -shb ~/Pictures | cut -f1` | |
let "res=($before_size-$after_size)/1024" | |
# TODO: Show how much data was cleared dependently on it's size (KB, MB, GB, etc.) | |
echo "Cleared ${res}KB" | |
else | |
echo "There are no screenshots in ~/Pictures/ directory" | |
fi | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment