Skip to content

Instantly share code, notes, and snippets.

@klashxx
Created May 22, 2019 09:57
Show Gist options
  • Save klashxx/942fd1f7fcaf9973a731af018fac9511 to your computer and use it in GitHub Desktop.
Save klashxx/942fd1f7fcaf9973a731af018fac9511 to your computer and use it in GitHub Desktop.
#!/bin/bash
[[ $# -ne 0 ]] && { fs="${1}"; shift; } || fs="."
[[ ! -d $fs || ! -r $fs ]] && { echo "not dir/cant read it"; exit 5; }
[[ $# -ne 0 ]] && tam=$1 || tam=1
[[ ! $tam =~ ^[0-9]{1,}$ ]] && { echo "param must be a number (mbs)"; exit 5; }
(( tam *= 1024 * 1024 ))
find $fs -size +${tam}c -exec ls -ln {} \; 2>/dev/null | \
sort -r -k 5n | \
awk '{printf("%12.3f %s %s %s %s\n", $5/1024/1024, $NF, "("$7,$6,$8")")}'
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment