Is there a way to use the find command to recursively scan directories for files greater than 1Gb in size and print out the directory path and file name only?
Thanks in advance.
Is there a way to use the find command to recursively scan directories for files greater than 1Gb in size and print out the directory path and file name only?
Thanks in advance.
Some versions of find support extra values for files sizes this is generic
1953125 by 512 byte blocks = 1GB, this produces tow columns = directory name and filename
find /path -size +1953125 -print |
while read fname
do
echo "$(dirname $fname) $(basename $fname)"
done
2097151 ?
If you have GNU find available then use:
find . -type f -size +1G
Check your find version:
find --version
GNU find version 4.2.27
Thanks jim mcnamara, that is great. Do you know if it can be enhanced so that only the directories/files that the executing user id has access to are returned? ie, if a
error is returned, it won't be displayed in the list?
bipinajith, if I type
I get the following error
Thanks for your help guys!
Ok, that means you do not have GNU find
You can suppress the error messages by redirecting stderr to /dev/null
find /path -size +1953125 -print 2> /dev/null
Thanks bipinajith, that is perfect!