I ran code in test environment to find the files more than 1TB given below is a snippet from code:
FILE_SYSTEM=/home/arun
MAX_FILE_LIMIT=1099511627776
find $FILE_SYSTEM -type f -size +"$MAX_FILE_LIMIT"c -ls -xdev 2>/dev/null |
while read fname
do
echo "File larger than or equal to 1TB:"
echo $fname | awk '{print $11}'
done
The above is not listing any of the files as there is no such big files exists in my test environment. So, it is working fine.
But the same code in my production environment, lists the files smaller than 1TB also, like 6 GB files also.... at this point there is no file for 1TB also - so it is not listed.
My Question is: why it has picked up files lesser than the given size?
One more doubt: Is there any limitation on mumber of digits of parameters been passed to size option on find command? As per above 13-digits are passed.
Please help me out on this with your expert thoughts.
MAX_FILE_LIMIT=1073741824
find $FILE_SYSTEM -type f -size +"$MAX_FILE_LIMIT"k -ls -xdev
Hopefully, the same with G option will also work.-but capital G also works? i havn't tried.
Can you clear me, why this code:
MAX_FILE_LIMIT=1099511627776
find $FILE_SYSTEM -type f -size +"$MAX_FILE_LIMIT"c -ls -xdev 2>/dev/null
listed the files which are lesser than the given size.
I suspect, there is some limitation and that was restricting this find command to process normally with the given size and so it started listing all files from smaller to greater..... - i dont know, whether 6 GB is the smallest file at that time, but it started picking from that size.