1212
1313SUPPORTED_FORMATS = ['jpg' , 'jpeg' , 'tif' , 'tiff' , 'webp' , 'heic' ]
1414
15- __version__ = '0.8.4 '
15+ __version__ = '0.8.5 '
1616
1717
1818# Ported from: https://github.com/victordomingos/optimize-images
@@ -42,8 +42,10 @@ def main():
4242 parser = argparse .ArgumentParser (description = 'This tool will recursively update image file timestamps to '
4343 'information from EXIF tag DateTimeOriginal.' )
4444 parser .add_argument ('directory' , metavar = 'directory' , type = str , help = 'Directory to start from' )
45- parser .add_argument ('-v' , '--verbose' , help = 'show every file processed' , action = 'store_true' )
45+ parser .add_argument ('-nr' , '--no-recursion' , action = 'store_true' ,
46+ help = "Don't recurse through subdirectories." )
4647 parser .add_argument ('--rename' , help = 'Rename file to IMG_DATE_TIME (IMG_YYYYMMDD_HHMMSS)' , action = 'store_true' )
48+ parser .add_argument ('-v' , '--verbose' , help = 'show every file processed' , action = 'store_true' )
4749 parser .add_argument ('--version' , action = 'version' , version = '%(prog)s ' + __version__ )
4850 args = parser .parse_args ()
4951 print ('ExifDate2FS' , __version__ )
@@ -52,11 +54,16 @@ def main():
5254 directory = os .path .abspath (pathlib .PureWindowsPath (args .directory .rstrip ("\" " )))
5355 else :
5456 directory = os .path .abspath (pathlib .PurePosixPath (args .directory ))
55- print ('Processing recursively starting from' , directory )
57+ if args .no_recursion :
58+ print ('Processing non-recursively starting from' , directory )
59+ recursive = False
60+ else :
61+ print ('Processing recursively starting from' , directory )
62+ recursive = True
5663 if not os .access (directory , os .W_OK ):
5764 print ('No such directory or not writable' )
5865 sys .exit (1 )
59- for filepath in search_images (str (directory ), recursive = True ):
66+ for filepath in search_images (str (directory ), recursive = recursive ):
6067 with open (filepath , 'rb' ) as f :
6168 tags = exifread .process_file (f , details = False , stop_tag = 'DateTimeOriginal' )
6269 if 'EXIF DateTimeOriginal' in tags .keys ():
0 commit comments