Created
November 11, 2018 18:27
-
-
Save gioxx/8c9536f6db81ccc95b1c92671949168d to your computer and use it in GitHub Desktop.
Uno script bash che permette di organizzare un gruppo di immagini in cartelle che ne contengono al massimo 300 cadauna. Vedi post sul blog: https://wp.me/pdQ5q-9UO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Blocco rename da JPG/JPEG/jpeg a jpg | |
# Credits: https://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/x4055.htm | |
for i in *.JPG; | |
do mv $i ${i%%.JPG}.jpg; | |
done | |
for i in *.JPEG; | |
do mv $i ${i%%.JPEG}.jpg; | |
done | |
for i in *.jpeg; | |
do mv $i ${i%%.jpeg}.jpg; | |
done | |
# Riorganizzo le immagini in cartelle in blocchi da 300 ($c -eq 300) | |
# Credits: https://unix.stackexchange.com/posts/180105/revisions | |
c=1; d=1; mkdir -p PICS_${d} | |
for jpg_file in *.jpg | |
do | |
if [ $c -eq 300 ] | |
then | |
d=$(( d + 1 )); c=0; mkdir -p PICS_${d} | |
fi | |
mv "$jpg_file" PICS_${d}/ | |
c=$(( c + 1 )) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment