File tree 1 file changed +12
-5
lines changed
1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,11 @@ if [ "$1" = "recurse" ]; then
8
8
fi
9
9
10
10
find . -type d | while read -r dir; do
11
+ if ! cd " $CWD " ; then
12
+ echo " cwd '$CWD ' doesn't exist."
13
+ exit 1
14
+ fi
15
+
11
16
if [ " $dir " = ' .' ]; then
12
17
continue
13
18
fi
@@ -21,12 +26,14 @@ find . -type d | while read -r dir; do
21
26
count=" $( find . -type f | wc -l) "
22
27
else
23
28
count=" $( find . -maxdepth 1 -type f | wc -l) "
29
+ countWithFolders=" $( find . -maxdepth 1 | wc -l) "
30
+ (( countWithFolders-- ))
31
+
32
+ # No files, but there are folders... Just ignore it.
33
+ if [ " $count " -eq 0 ] && [ " $countWithFolders " -gt 0 ]; then
34
+ continue ;
35
+ fi
24
36
fi
25
37
26
38
echo " $count $dir "
27
-
28
- if ! cd " $CWD " ; then
29
- echo " cwd '$CWD ' doesn't exist."
30
- exit 1
31
- fi
32
39
done | sort -nr | head -" ${1:- 1} "
You can’t perform that action at this time.
0 commit comments