-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind-large-dirs
More file actions
36 lines (26 loc) · 748 Bytes
/
find-large-dirs
File metadata and controls
36 lines (26 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
#!/bin/bash
LANG=C
cmdname=`basename $0`
ionice_bin=`which ionice`;
if [ "$ionice_bin" == "" ]
then
echo "ionice not installed. Proceed with install? (CTRL+C to Abort)"
echo "or run install manually: apt-get install util-linux coreutils less"
read
apt-get -y install util-linux coreutils less
fi
function usage() {
cat <<EOF
Usage: ${cmdname} /path/to/folder
Interactive script to calculate disk usage of top folders.
by default scans all directories ( "/" ).
-h --help : Help (this screen).
EOF
}
case "$1" in
"") path="/" ;;
-h|--help) usage; exit; ;;
*) path=$1 ;;
esac
nice -n19 ionice -c 3 du -m --exclude=/proc ${path} | perl -ne '@l = split();print "@l\n" if [0]>=5000' |sort -nr | less