photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: javiavid on April 13, 2021, 06:10:37 PM

Title: Category to order photos with wrong date
Post by: javiavid on April 13, 2021, 06:10:37 PM
I would like to create a category that shows the files in which the creation date can not match the year of the folder in which they are contained.

An example:

Full Name:      D: \ Photos \ 2016 \ Capture \ 2016-05-04 05.08.02.png
Create Date:   04/11/2021 21:08:20

My idea was to extract the year from the folder with:
{File.Fullname | contains: \ 2016 \, 2016}

And the year of creation with:
{File.datetime | format:YYYY}

Compare both and if they are not equal to be displayed in the category.

I'm not very clear how to do it, I also would like not to have to include every year with Contains (Maybe a regex?)

Title: Re: Category to order photos with wrong date
Post by: Mario on April 14, 2021, 09:24:15 AM
Tricky. You would have to create a variable-based data-driven category for each year, unless you can somehow extract the year with a substr.
That would require that you have a strict naming convention for folders so the year is always at the same place. You need to figure that out.

Note that in variables, blanks and case is significant (your variables did not work because you used the wrong case).

This expression returns either Same or Different, depending on whether the folder "year" (2016) and DateTime match.

{File.FullName|contains:2016,2016;is:{File.DateTime|format:YYYY},Same,Different}

Using this for a data-driven category produces two children. One for the files where the date matches and one for files where the date does not match.
Title: Re: Category to order photos with wrong date
Post by: javiavid on April 14, 2021, 08:33:21 PM
Is there any way to use a regex to extract the year from the folder?

With the regex [0-9]{4}\\ I get 2016\ if I then use is:{File.DateTime|format:YYYY\},Same,Different} it should work.

But I don't know if it's possible to do this, I don't understand very well how to use the regex of the variables.
Title: Re: Category to order photos with wrong date
Post by: Mario on April 14, 2021, 08:37:10 PM
If I can ask you to search the Variables (https://www.photools.com/help/imatch/#var_basics.htm) help topic for regexp, you will see which variable functions are available for regular expressions.
If something is not documented there, it is not supported. This should answer your question, I believe.
Title: Re: Category to order photos with wrong date
Post by: javiavid on April 14, 2021, 10:09:06 PM
Sorry I insisted, I was trying with filter:Regexp options but I didn't get what I wanted. I thought it was because I wasn't using it correctly.

Thanks for your help