kimlew / bash-sort-images

Script that sorts photo files into year & month subdirectories, and if needed, day
0 stars 0 forks source link

Missing `continue` statement in main loop (I think) #2

Closed kcharter closed 4 years ago

kcharter commented 4 years ago

In the first case of

https://github.com/kimlew/bash-sort-images/blob/16847406d5bedc500235cf93c761493c8a512b7d/sort_images.sh#L70-L76

you print a message saying you are skipping to the next file, but you don't use a continue statement to go to the next iteration of the loop.

This does funny things. I created an empty file that matches the *.jpg file name pattern with

touch bogus.jpg

and because other files got moved before this one, the loop printed an error message but then moved the file to the same directory as the previous file. Here's a snippet of output:

EXIF date is:
MODIFY date is:
Error: The file, ./bogus.jpg
- is missing exif date or modify date metadata - so skipping this file
Continuing with next file ...
Year is:  2018
Month is:  09
a_file_name: ./bogus.jpg
just_path: .
just_filename: bogus.jpg
Day is:  30
Path with year_month_day: ./2018/09/30
new_dir_and_filename: ./2018/09/30/bogus.jpg
kimlew commented 4 years ago

@kcharter Okie dokie. I've added continue statement after echo "Continuing with next file ..."

kcharter commented 4 years ago

@kimlew OK, I see it fixed in commit c14f9753036467c6a8b670c40acb03cea05bd340. Let me know if you'd like me to close the issue instead of you.