File Searching
I am trying to write a script to find all files under a given file size.
I am using the following commands:
------------------------------------------------------------------------------------------
while [ $size -ge 0 ]
do
x=$(find /home -type f -printf %s'\t'%p'\n' | grep -b $size | wc -l)
let size=size-1
let n=n+x
done
------------------------------------------------------------------------------------------
therefore at the end, the variable 'n' is suppose to represent the number of files under the given file size. The only problem with this is that a file that has a size of 157, is counted for 157, 57, 15, 7, 5, & 1. So that single file is counted as 6 seperate files according to my stupid script.
If anyone has any suggestions on how to make a correct script or command to accomplish this task i would greatly appreciate it.
Thanks,
|