Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: To find files with size more than the provided limt at any provided Location  (Read 1752 times)

0 Members and 1 Guest are viewing this topic.

jamesj

  • Guest
Following script can be used to find the file size more than the desired size in the desired location.

Code: [Select]
# read -p "Enter the path: " path; read -p "Enter the size(k/M/G): " size; find $path -type f -size +$size -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

Example:

If you want to find the file size in /home/titans directory with file size above 20Mb

# read -p "Enter the path: " path; read -p "Enter the size(k/M/G): " size; find $path -type f -size +$size -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Enter the path: /home/titans
Enter the size(k/M/G): 20M


Result
---------
/home/titans/test/domlogs/cskidpjx/csk-idrettsskolen.no: 24M
/home/titans/test/dell-dset-lx64-3.7.0.219.bin: 31M