Skip to content

Commit

Permalink
check if date is valid if file needs to be renamed
Browse files Browse the repository at this point in the history
  • Loading branch information
mweb committed Sep 20, 2018
1 parent ea5e3d3 commit d516347
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sortphotos.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def sortPhotos(src_dir, dest_dir, sort_format, rename_format, recursive=False,
# rename file if necessary
filename = os.path.basename(src_file)

if rename_format is not None:
if rename_format is not None and date is not None:
_, ext = os.path.splitext(filename)
filename = date.strftime(rename_format) + ext.lower()

Expand Down

0 comments on commit d516347

Please sign in to comment.