Messy library. Too many copies. Several renames

Started by smaiderman, January 25, 2024, 12:01:08 PM

Previous topic - Next topic

Phil Harvey

Hehe.  Odd.  On Mac it isn't such a free-for-all. ;)

- 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 ($).

smaiderman


smaiderman

Quote from: Phil Harvey on January 25, 2024, 12:52:32 PM"AllDates" is a shortcut for the 3 common EXIF date/time tags (DateTimeOriginal, ModifyDate and CreateDate).

Is there a shortcut to FileModifyDate and FileCreateDate (i dont care about FileAccessDate, but its ok if it changes too). I want to change every date in the file properties, including exif, and I tried with exiftool "-time:All<DateTimeOriginal" without success.

Phil Harvey

The filesystem date/time tags are marked as Unsafe so they aren't updated with Time:All.  You need to do these individually.

- 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 ($).

StarGeek

Quote from: smaiderman on January 27, 2024, 07:12:35 AMIs there a shortcut to FileModifyDate and FileCreateDate (i dont care about FileAccessDate, but its ok if it changes too).

It is possible to create your own shortcuts.  The very first section of the example.config file has details on how to do so and how to create a .ExifTool_config file so it will always be available.

In this post I give some examples of shortcut tags I made and regularly use.  The "Systime" shortcut listed there is what I use to write to the FileCreateDate/FileModifyDate tags at the same time.

Exiftool can't write the FileAccessDate and there really isn't a need to because it will automatically be changed any time the computer ever touches the file. For example, viewing an image will automatically set it to the time that happens.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype


smaiderman

Quote from: StarGeek on January 27, 2024, 09:57:04 AMIt is possible to create your own shortcuts.  The very first section of the example.config file has details on how to do so and how to create a .ExifTool_config file so it will always be available.

In this post I give some examples of shortcut tags I made and regularly use.  The "Systime" shortcut listed there is what I use to write to the FileCreateDate/FileModifyDate tags at the same time.

Exiftool can't write the FileAccessDate and there really isn't a need to because it will automatically be changed any time the computer ever touches the file. For example, viewing an image will automatically set it to the time that happens.

Thank you  :D

It is harder than my knowledge level, and if you dont mind, I would like to ask some questions.

My main goal is to modify every date in the file info and exif info to the same value (the original one). So, in .ExifTool_config I wrote this

%Image::ExifTool::UserDefined::Shortcuts = (
    MasterDateVideo =&gt; ['exif:CreateDate','exif:DateTimeOriginal','exif:ModifyDate','exif:MediaModifyDate','exif:MediaCreateDate','exif:TrackModifyDate','exif:TrackCreateDate','FileCreateDate','FileModifyDate','XMP:DateTimeOriginal','XMP:CreateDate','XMP:ModifyDate']
    MasterDateFoto =&gt; ['exif:CreateDate','exif:DateTimeOriginal','FileCreateDate','FileModifyDate','exif:ModifyDate','exif:TimeStamp','exif:SubSecDateTimeOriginal','exif:SubSecMoifyDate','exif:SubSecCreateDate','XMP:DateTimeOriginal','XMP:CreateDate','XMP:ModifyDate']
);
#------------------------------------------------------------------------------
1;  #end

1. Would this be ok, and cover most time tags? (I've seen some 'Quicktime:xxx' tags, but I tried to find them in my media and I couldn't.)
2. I've seen some examples using CreateDate instead of exif:CreateDate Which one is correct?
3. In the example that you provide, it is written =&gt, but I've seen you write also => in other forum posts. Which one should I use?

4. Can I delete everything else in the .ExifTool_config file? I only need this shortcut to rewrite all time data fields.

5. In the case that everything is correct, as the file name is .ExifTool_config , do I only need to place it in the same folder as Exiftool.exe ? (I think -config is only used if the name is different than .ExifTool_config)

Thank you very much again

Phil Harvey

There were a few format problems with your config file.  The "&gt;" should be a ">" symbol, and there needs to be a comma after the closing "]" at the end of each line.  You can delete everything else in the config file.  If you name it .ExifTool_config and place it in the same directory as exiftool.exe you don't need to use the -config option.

I would recommend not specifying the "exif:" group.  In fact, most of the tags you specify aren't even EXIF, so this won't work.  If you just want to change existing tags, it is better to not specify the group so all tags of this name will be changed, and add "-wm w" to the command so new tags aren't created.

- 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 ($).

smaiderman

Great. I missed the final commma.
Thanks for the advice. I think I'm getting really close to what I need.

Thank you!
I just made a donation :)

smaiderman

Well.
I managed to create a simple command to do what I was looking for.

The command is the next:

exiftool "-MasterDates<OldestDateTime" -wm w DIR

My .ExifTool_config is:
%Image::ExifTool::UserDefined::Shortcuts = (
    MasterDates => ['DateAcquired','CreateDate','DateTimeOriginal','FileCreateDate','FileModifyDate','ModifyDate','TimeStamp','MediaModifyDate','MediaCreateDate','TrackModifyDate','TrackCreateDate','SubSecDateTimeOriginal','SubSecMoifyDate','SubSecCreateDate','XMP:DateTimeOriginal','XMP:CreateDate','XMP:ModifyDate'],
  );

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        # Select oldest date from a number of date tags
        OldestDateTime => {
            Desire => {
                0 => 'FileModifyDate',
                1 => 'MDItemFSContentChangeDate',
                2 => 'FileCreateDate',
                3 => 'MDItemFSCreationDate',
                4 => 'ModifyDate',
                5 => 'CreateDate',
                6 => 'DateTimeCreated',
                7 => 'DateTimeOriginal',
                8 => 'DateAcquired',
                9 => 'MediaCreateDate',
                10 => 'TrackModifyDate',
                11 => 'TreackCreateDate',
                12 => 'XMP:DateTimeOriginal',
                12 => 'XMP:CreateDate',
                12 => 'XMP:ModifyCreateDate',
            },
            ValueConv => q{
                my $oldest = undef;
                for my $date (@val) {
                    next if not defined $date or $date lt '1970:01:02';
                    $date =~ s/[+-]\d{2}:\d{2}$//; # Strip TimeZone
                    if ($date && (!$oldest || $date lt $oldest)) {
                        $oldest = $date;
                    }
                }
                return $oldest;
            },
        },
    },
);

1;

This will check for the majority date time tags in the file (I will add more if I find new ones), take the oldest one, and write it in every date time tag that is present in the file.


As long as I'm writting this message, it comes to my mind that there is going to be a sitouation with the files that dont have exif data. I mean, this solution will modify the dates present in the file information, but there will be files missing exif info.

This is because -wm w is in the command. The problem if I remove it, is that I will create a lot of false tags in every file, and I dont know if it is appropiate.


One solution that comes to my mind is to do,

1st

Add a new Shortcut in .ExifTool_config  "MasterDatesNE" with the most common tags (? Again, I dont know if this is a good practice, but I think I would like the files to have the time data in the exif so I dont have the messy FileCreate/ModifyDate problem that I'm having now )
and use this command:
exiftool "-MasterDatesNE<OldestDateTime" -if "not $exif:all" DIR

And 2nd 
exiftool "-MasterDates<OldestDateTime" -wm w DIR



What do you think?

(I'm enjoying so much. This is like a really hard riddle!)



Phil Harvey

I think I would just go with removing the -wm w.  You will create XMP in JPG files (for CreateDate at least), but that may actually not be a bad idea.  (Actually, I see you've left the XMP tags in here too, so good.)  Note that "SubSecMoifyDate" should be "SubSecModifyDate" in your config file.

- 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 ($).

smaiderman

Thank you. I'll go that way.

edit: had a doubt but already solved it