-
Notifications
You must be signed in to change notification settings - Fork 11
/
dir-usage
executable file
·35 lines (32 loc) · 1.09 KB
/
dir-usage
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
#!/bin/sh
# dir-usage utility
# part of the security-assessor project
# Copyright (c) 2024 Steve Grubb. ALL RIGHTS RESERVED.
#
# This software may be freely redistributed under the terms of the GNU
# public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
# cd to the right directory and run this command
for file in .* *; do
[ -h "$file" ] || [ "$file" = "." ] || [ "$file" = ".." ] && continue
if [ -d "$file" ]; then
[[ "$file" =~ ^/(dev|media|proc|srv|sys) ]] && continue
du -sh "$file" 2>/dev/null
fi
done
#list=`ls -a $dir 2>/dev/null`
#if [ "$dir" = "/" ] ; then dir=""; fi
#for file in $list
#do
# if [ -h $dir/$file ] || [ $file = ".." ] || [ $file = "." ] ; then
# continue
# elif [ -d $dir/$file ] ; then
# res=`echo "$dir/$file" | grep -E '^/dev|^/media|^/proc|^/srv|^/sys'`
# if [ "x$res" != "x" ] ; then continue; fi
# result=`du -sh $dir/$file 2>/dev/null`
# if [ $? -eq 0 ] ; then echo "$result"; fi
# fi
#done