-directory AND -r

Started by audiogalaxy, June 03, 2024, 05:42:10 AM

Previous topic - Next topic

audiogalaxy

Hallo I've tried this:

exiftool -if 'not ($Album and $Title and $Artist)' -directory=_untagged -r -ext mp3 -ext flac .
and if it works perfectly well when run ONLY in a folder with mp3 and flac without subdirectories (no recursion) , when it has to act in the subdirectories it creates the "collection" (_untagged) directory only in the root, making a mess, while I expected (but it's my problem, I guess) that the directory would be created at the point in the recursion where the file whose detection occurs is located.

Is there a need for some change in how something works ... or have you some suggestions on how can I make it work? :)
I mean... without using batch script and another recursion with no "-r".
--
Sorry for my halting English: I'm not a natural English speaker.
On a PC / windows commandline

StarGeek

As long as you are using the dot for the current directory, and you want to recreate the directory tree, add the %d variable to the end of your directory path

-directory=_untagged/%d

Short example using Testname
Y:\!temp\x>exiftool -r -ext jpg -Testname=_untagged/%d .
'./y/002.JPG' --> '_untagged/./y/002.JPG'
'./y/003.JPG' --> '_untagged/./y/003.JPG'
'./y/004.JPG' --> '_untagged/./y/004.JPG'
'./y/005.JPG' --> '_untagged/./y/005.JPG'
'./y/006.JPG' --> '_untagged/./y/006.JPG'
'./y/007.JPG' --> '_untagged/./y/007.JPG'

Here, files in directory ./y/ are moved to _untagged/./y/.  Since the dot stands for that current directory, _untagged/. is basically the same as _untagged/, so the final result will be _untagged/y/

If you used a full file path, for example if I tried to use
exiftool -r -ext jpg -Testname=_untagged Y:\!temp\x
I would have had to modify the %d to remove the top three directories (see the Advanced features part of the -w (-TextOut) option)
exiftool -r -ext jpg -Testname=_untagged/%:3d Y:\!temp\x

Example
C:\>exiftool -r -ext jpg -Testname=_untagged/%:3d Y:\!temp\x
'Y:/!temp/x/y/002.JPG' --> '_untagged/y/002.JPG'
'Y:/!temp/x/y/003.JPG' --> '_untagged/y/003.JPG'
'Y:/!temp/x/y/004.JPG' --> '_untagged/y/004.JPG'
'Y:/!temp/x/y/005.JPG' --> '_untagged/y/005.JPG'
'Y:/!temp/x/y/006.JPG' --> '_untagged/y/006.JPG'
'Y:/!temp/x/y/007.JPG' --> '_untagged/y/007.JPG'
* 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).

audiogalaxy

Sorry, I didn't myself understoot: my fault.

My goal would be to obtain this:

CD \starting
c:\starting

suppose I have:

c:\starting\a\b\c
in "a" and in "c" directories there are some FLAC files matching the trigger, e.g. they miss "album" tag.

I need to obtain:

c:\starting\a\_untagged\file1.flac
c:\starting\a\_untagged\file2.flac
c:\starting\a\_untagged\file ....
c:\starting\c\_untagged\file1.flac
c:\starting\c\_untagged\file2.flac
c:\starting\c\_untagged\file ....

And I can't find the way to do it without using batch scripting
--
Sorry for my halting English: I'm not a natural English speaker.
On a PC / windows commandline

StarGeek

So you want to use only the directory where the file is located?

Try
exiftool -r -ext jpg -Directory=%-1:d_untagged/ .

See the link I gave above for how to edit the %d variable.
* 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).

audiogalaxy

Quote from: StarGeek on June 03, 2024, 03:54:21 PMSo you want to use only the directory where the file is located?

Try
exiftool -r -ext jpg -Directory=%-1:d_untagged/ .

See the link I gave above for how to edit the %d variable.

yeah! I used:

exiftool -if "not ($Album and $Title and $Artist)" -Directory=%-1:d_untagged/ -r -ext mp3 -ext flac .
and it WORKED! THANKS
--
Sorry for my halting English: I'm not a natural English speaker.
On a PC / windows commandline