runs recursively even without -r?

Started by TinCanFury, September 06, 2021, 12:26:00 PM

Previous topic - Next topic

TinCanFury

 $ exiftool -ver
12.30

Every time I run a command with a directory location exiftool runs recursively and goes through subdirectories as well. Is there a way to not run recursively on the directory I'm processing?

StarGeek

What is your exact command?

I've never seen exiftool recurse through subdirectories without the -r (-recurse) option.  Also see Common Mistake #2b if you're using *.* or something similar.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

TinCanFury

exiftool -v -overwrite_original -if '(defined $ModifyDate and not defined $DateTimeOriginal)' "-datetimeoriginal<ModifyDate" .
exiftool -v -overwrite_original -if '(defined $ModifyDate and not defined $CreateDate)' "-createdate<ModifyDate" .
exiftool -v -overwrite_original -if '(defined $DateTimeOriginal and not defined $CreateDate)' "-createdate<datetimeoriginal" .
exiftool -v -overwrite_original -if '($Software =~ /Instagram/)' "-DateTimeOriginal<filename" "-CreateDate<filename" .
exiftool -v -overwrite_original  -if '(not defined $DateTimeOriginal or not defined $CreateDate)' "-alldates<filemodifydate" .

(feel free to provide any pointers on cleaning these commands up. they do what I need/want, but that doesn't make them pretty 😝 )

thanks!

StarGeek

I cannot reproduce this.  Using your same first command, only swapping the single quotes for double quotes, exiftool only processes files in the current directory, not the subdirectories.
Y:\!temp\aa>tree /f .
Folder PATH listing for volume DrivePool
Volume serial number is 3881-4F27
Y:\!TEMP\AA
│   File_00.jpg
│   File_01.jpg
│   
└───Sub1
    │   File_02.jpg
    │   File_03.jpg
    │   
    └───Sub2
            File_04.jpg
            File_05.jpg

Y:\!temp\aa>exiftool -G -a -s -AllDates -r Y:\!temp\aa
======== Y:/!temp/aa/File_00.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/File_01.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/File_02.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/File_03.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/Sub2/File_04.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/Sub2/File_05.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
    3 directories scanned
    6 image files read


Y:\!temp\aa>exiftool -overwrite_original -if "(defined $ModifyDate and not defined $DateTimeOriginal)" "-datetimeoriginal<ModifyDate" .
    1 directories scanned
    2 image files updated

Y:\!temp\aa>exiftool -G -a -s -AllDates -r Y:\!temp\aa
======== Y:/!temp/aa/File_00.jpg
[EXIF]          DateTimeOriginal                : 2021:09:07 07:37:49
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/File_01.jpg
[EXIF]          DateTimeOriginal                : 2021:09:07 07:37:49
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/File_02.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/File_03.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/Sub2/File_04.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
======== Y:/!temp/aa/Sub1/Sub2/File_05.jpg
[EXIF]          ModifyDate                      : 2021:09:07 07:37:49
    3 directories scanned
    6 image files read


Can you list example output where this happens?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

TinCanFury

I assume you did the quote swap because you are on Windows (I'm on linux)? or is there some other benefit to using the double quotes?

I don't at this time have any files in the folders I run these one (I have later commands that move the files to an organized structure folder, but I'll revisit with example output when I go through this process again.

thanks!

StarGeek

Quote from: TinCanFury on September 07, 2021, 12:47:19 PM
I assume you did the quote swap because you are on Windows (I'm on linux)?

That is correct.

Quoteor is there some other benefit to using the double quotes?

On linux, you'll want to use single quotes overall.  It can use either one except if there is a dollar sign, such as with your -if options, as the shell will think it's the start of a shell variable. Also quotes need to surround an asterisk if it's not part of a filename to prevent shell file globbing.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).