Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jpg=""
- count=`ls -1 *.jpg 2>/dev/null | wc -l`
- if [ $count != 0 ]
- then
- echo jpg files found: $count ; jpg="yes"
- fi
- #!/bin/bash
- shopt -s nullglob
- for ext in jpg png gif; do
- files=( *."$ext" )
- printf 'number of %s files: %dn' "$ext" "${#files[@]}"
- # now we can loop over all the files having the current extension
- for f in "${files[@]}"; do
- # anything else you like with these files
- done
- done
- ls | awk -F . '{print $NF}' | sort | uniq -c | awk '{print $2,$1}'
- exts=( *.jpg *.png *.gif ); printf "There are ${#exts[@]}" extensions;
- extensions="jpg png gif"
- for ext in $extensions; do
- c=$(find . -maxdepth 1 -iname "*.$ext" -print0 | tr -d -c "