Hello i try to create bash function search videos file in folder and if find file size bigger then 32mb show msg file has exceeded 32MB in size
help me to complete
my code
RESULTS_SIZE=$(find /folder/ -maxdepth 1 -iregex ".*\.\(mov\|mpeg\|wav\|mp4\|avi\|mpg\|flv\|WMV\|AVI\|mkv\)" -exec stat -c %s "{}" \;)
if [ "$RESULTS_SIZE" -gt 32768 ]
then
echo "Results file has exceeded 32MB in size." exit 1;
fi
Simply use the
-sizeswitch offind, with-prefix for size below N,+for size over N, andb,k,M,Gsuffixes for bites,kilobytes, Megabytes, or Gigabytes:If you want it in bash you could do: