Recursively searches from current directory reporting the location and count of all files greater than the specified size. Add it to the .bashrc file for an easy find tool.
Example usage is 
  findlargest
  findlargest 5M
  findlargest 1G
defaults to 50Mb
function findlargest_inner { 
  eval "find . type f -size +${1:-50M} -exec ls -lh {} \;" \
  2>&1 | \
  grep -v "Permission denied" | \
  awk '{ print $9 ": " $5 }' | \
  grep -v -e '^:.*';
}
function findlargest {
  findlargest_inner $@
  echo "Number of files found with size>${1:-50M} is :"
  findlargest_inner $@ | wc -l
}
Sunday, March 29, 2015
Subscribe to:
Comments (Atom)
 
 
 Posts
Posts
 
