Hi ,
I am trying to get the folder details having size more than sme specified value and also the name of the folder should be like TEST.
so
In the current directory search for all the folders having name like TEST
Print the list of the folder names having size more than 100 Kilobyte.
Please help.
PikK45
April 5, 2013, 10:01am
2
find . -type d -name "*TEST*" -size +102400c -print
One way:
find . -type d -exec du -s '{}' \; | awk '$1>100{print $2}'
@Pikk45 :
Your solution is relying on the size shown by the ls -l output which actually is the block size for a directory. The size of directory should be determined by the total accumulated size of all files present in the directory which du command does.
Guru.
PikK45
April 5, 2013, 10:28am
4
guruprasadpr:
One way:
find . -type d -exec du -s '{}' \; | awk '$1>102400{print $2}'
@Pikk45 :
Your solution is relying on the size shown by the ls -l output which actually is the block size for a directory. The size of directory should be determined by the total accumulated size of all files present in the directory which du command does.
Guru.
Cool!! You are the GURU
But when you execute the command of yours, won't it take the present directory that is "." into account as well? <whisper: Got you on this one :D>