Skip to main content

Problem:

How do I find files larger than a specified number of blocks?

Resolution:

The following script shows how one might use -size to return a full listing of files in a recursive find.

We display the owner, size and location.

support 1884712 ./products/SX50EAP/lib/libcobcheck.so

support 1884712 ./products/SX50EAP/lib/libcobcheck.so.2

#! /bin/sh

# largerthan

# find a standard file from current directory, larger than n-bytes

if [ $# -lt 1 ] ; then

    echo "usage:  largerthan  nunmber-of-bytes   [user] "

    exit 1

fi

if test $2

then

    USR=" -user $2 "

fi

find . -size $1c -type f  $USR -print | xargs ls -l | awk '{ print $3 "\\t" $5 "\\t" $9 }'

Old KB# 3712