Add new tool dirsize.sh
This commit is contained in:
parent
009de60f5f
commit
ce641135eb
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
if [[ -f "/tmp/dir.list" ]]; then
|
||||||
|
rm "/tmp/dir.list"
|
||||||
|
fi
|
||||||
|
if [[ -f "/tmp/dir.list" ]]; then
|
||||||
|
echo "Couldn't delete the temp file from a previous run."
|
||||||
|
echo "As root please run..."
|
||||||
|
echo
|
||||||
|
echo "# rm /tmp/dir.list"
|
||||||
|
echo
|
||||||
|
echo "or use sudo..."
|
||||||
|
echo
|
||||||
|
echo "$ sudo rm /temp/dir.list"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
find . -maxdepth 1 -type d > "/tmp/dir.list"
|
||||||
|
while read -r foldername; do
|
||||||
|
if [[ $foldername != "." ]]; then
|
||||||
|
du -h $foldername | tail -1
|
||||||
|
fi
|
||||||
|
done < "/tmp/dir.list"
|
||||||
|
rm "/tmp/dir.list
|
Loading…
Reference in New Issue