News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

My configfile needs a small adjustment (HH:MM:SS)

Started by aage, September 04, 2014, 03:11:48 PM

Previous topic - Next topic

aage

Hi

In https://exiftool.org/forum/index.php/topic,5708.msg27880.html#msg27880 Phill made me a very nice config-file attatched in this post. The config-file is used for renaming all my media-files based on different dates.

Now I have noticed that I have a lot of different files from the exact same day (but locatede) in different folders. When renamed by the confifile I end up with a lot of duplicates. When moving all renamed files in to new folders ( Year, month and date) I get a lot of "already exists".

I think adding the "_HH:MM.SS" to the var "MyFileName" in the configfile will solve this problem.

Can anyone modify the configfile for me ?

Thanks in advance ;-)
/Aage

Phil Harvey

Hi Aage,

You have to be careful with the ":" character because it can't be used in a file name.  Without this, you can do what you want by changing the "return" statement of MyFileName to this:

return "${make}$parts[2]$parts[1]$parts[0]_$parts[3]$parts[4].$parts[5]$daughter$son";

Here the hours, minutes and seconds are represented by $parts[3], $parts[4] and $parts[5] respectively.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

Hi Phil

Thanks - just tried and it kind of worked ;-)

My files are now named like this : 10062008_0822.10+02_L10M_0001.MOD

I would like them to be named : 10062008_082210_L10M_0001.MOD

How should I modify the command underneath to accomplish this :
return "${make}$parts[2]$parts[1]$parts[0]_$parts[3]$parts[4].$parts[5]$daughter$son";

P.S. I think I have read, somewhere, in a forum-post that it is possible to add a command that adds a number handling files that already exist in the destination-folder when moved - is that correct ( I can´t find it again)

/Aage

Phil Harvey

Right.  The timezone hours are part of $parts[5].  Also, you don't want the "." before the seconds.  So remove the "." from your return string, and change this:

my @parts = split /[: ]/, $date;

to this:

my @parts = split /[-+: ]/, $date;

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

Hi Phil

That, of cource, worked perfectly ;-)

Now all files are named like : Canon_02102011_084739_L4Y2M_J1Y5M_0001.JPG

Next step in my workflow is to set the subjet using this command:
exiftool -ext MOV -ext MOD -ext JPG -ext AVI -ext MPG '-subject<${filename;s/_\d+\..*$//;}' -sep "_" -overwrite_original -r /Users/Aagesen/Exif_NOT_DONE

My problem is now, that I also get a tag representing the timestamp (084739) and I do not need that at all ;-)

Can you, once again, help me out modifying the above command ?

/Aage

P.S. I have tried to find posts that explains code like "-subject<${filename;s/_\d+\..*$//;}' -sep". Can you point me in the right direction or tell me how you think I should learn this ? (I love the tool and I need to understand ;-))
I am trying to understand

Phil Harvey

So you want the old format of MyFileName written to the subject?  Simple:  Just define another tag (eg. MyFileName2) that does what you want, then copy this instead.

You should also note that ExifTool will not write all of the file formats you mentioned.  See the supported file types on the ExifTool home page for details.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

Hi Phil

It took me some time to figure it out - BUT I did ;-)

I made an new configfile and added the new tag "MyFileName2". Then I ran this command:

exiftool -config Aage6_TEST.config -ext MOV -ext MOD -ext JPG -ext AVI -ext MPG '-subject<${MyFileName2;s/_\d+\..*$//;}' -sep "_" -overwrite_original -r /Users/Aagesen/Exif_DONE_DATE

Compared to my old step of writing TAG´s I have added the config-file to the command and are now using the "MyFileName2" instead of FileName.

It works but I have read the documentation about "over-scripting" and think thats is exactly what I am doing ;-)
Can I do this in a smarter way - maybe using some of the code from "MyFileName" instead of having the configfile "compute" the same code several times?

P.S. I am aware that not all filetypes are supported - I just need to clean up my code ;-)

/Aage


Phil Harvey

Hi Aage,

What you have done is reasonable.  The comment about over-scripting relates to the use of other scripting tools when ExifTool could handle the job by itself.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

Hi Phil

Super !

All my files are now processed and it works perfectly !

Thank you very much for all the help and a great tool !!!

/Aage