Author Topic: My configfile needs a small adjustment (HH:MM:SS)  (Read 3451 times)

aage

  • Full Member
  • ***
  • Posts: 38
My configfile needs a small adjustment (HH:MM:SS)
« on: September 04, 2014, 03:11:48 PM »
Hi

In http://u88.n24.queensu.ca/exiftool/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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14895
    • ExifTool Home Page
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #1 on: September 04, 2014, 05:39:25 PM »
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:

Code: [Select]
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

  • Full Member
  • ***
  • Posts: 38
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #2 on: September 05, 2014, 10:57:11 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14895
    • ExifTool Home Page
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #3 on: September 05, 2014, 11:05:57 AM »
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:

Code: [Select]
my @parts = split /[: ]/, $date;
to this:

Code: [Select]
my @parts = split /[-+: ]/, $date;
- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

  • Full Member
  • ***
  • Posts: 38
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #4 on: September 06, 2014, 05:51:00 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14895
    • ExifTool Home Page
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #5 on: September 06, 2014, 07:33:00 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

  • Full Member
  • ***
  • Posts: 38
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #6 on: September 07, 2014, 03:23:44 AM »
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14895
    • ExifTool Home Page
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #7 on: September 07, 2014, 08:01:45 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

aage

  • Full Member
  • ***
  • Posts: 38
Re: My configfile needs a small adjustment (HH:MM:SS)
« Reply #8 on: September 15, 2014, 09:50:34 AM »
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