Shell script to organize images by date

Submitted by ravisagar on Sun, 11/12/2017 - 21:30

I have been clicking pictures in digital format since 2004 when I bought mobile phone with camera. It has been 13 years and I have lot of pictures. I used to manually organize the pictures by create a folder like YYYY-MM-DD_SOME_TEXT and for some reason I really like this format. These days people use Google Photos which is definitely amazing by I am still following the old fashioned way to manage the pics manually.

Most of the pictures I have taken in the past 13+ years are from mobile and stored in the memory card from from time to time I take them from mobile and store them separately by creating a folder by date. I feel lazy to create the folder by date manually and I used this nice shell script to create the folders with date name and nice organize all the pictures take on that date in that folder.


for x in *.jpg; do
d=$(date -r "$x" +%Y-%m-%d)
mkdir -p "$d"
mv -- "$x" "$d/"
done

If you are like me who likes to organize the pictures or in fact any file in this way, you can use the above shell script and even modify it to suit your requirements.

Have fun :)

Add new comment

Want to contact me?

Life begins outside your comfort zone and that is where your courage is developed". Write to me by filling this form. For living I am an Atlassian Consultant who love both Jira and Drupal. I am the author of "Mastering JIRA" and "Mastering JIRA 7" books. I Love both JIRA and Drupal (a bit more). You can Write To Me and I will get back to you as soon as I can. Have a nice day!

Social Links

Subscribe to my mailing list.

Enter your email address: