Skip to content

Instantly share code, notes, and snippets.

@nikto-b
Last active December 16, 2020 23:59
Show Gist options
  • Save nikto-b/b84e03ce625989a56d814b5005a46973 to your computer and use it in GitHub Desktop.
Save nikto-b/b84e03ce625989a56d814b5005a46973 to your computer and use it in GitHub Desktop.
#get all files in $DIR that matches $NAME created last $MINUTE minutes, sort them in alphabet,
#copy in current dir as jpg(sorry) and try to compress in $SIZE size (for example 400K)
export count=1
export files="$(find $DIR -type d -name $NAME -prune -o -mmin -MINUTE -type f -print | rg -v '\(' | sort -t _ -k 2 -g | tr '\n' ' ')"
for i in $(echo $files); do
cp $i ./$count.jpg
jpegoptim --size=$SIZE $count.jpg
count=$(($count+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment