Author Topic: Is it possible to search for files with sub seconds in file name?  (Read 2522 times)

Offline Skids

  • Newcomer
  • *
  • Posts: 21
    • View Profile
The background to my question is that I used the wrong time variable during ingest with the result that some images have a name in the form yyyy-mm-dd-HHMMSSss-Filename.ext where ss is subseconds that I did not intend recording in the file name i.e. my aim was for the following format without subseconds  yyyy-mm-dd-HHMMSS-Filename.ext.

I have tried searching with  search criteria like " {fbas:17,1} not equal to "-"  " but it does not seem to work in a search.

I'm thinking of writing the character returned by fbas to an unused metadata field and searching on that but wonder if there is a direct way?

Simon

Offline ahoward

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 973
    • View Profile
Re: Is it possible to search for files with sub seconds in file name?
« Reply #1 on: May 02, 2024, 08:39:23 AM »
Variables need an image to evaluate from, they are not parameters for searching. When you follow the search examples and do a search like
Quote
caption "the lazy dog."
"caption" specifies the name of the field that the search needs to be performed on; if its not one of the fields listed in searchable fields then it is not a field in your database. You can think of your catalog database like a big spreadsheet. All of the filenames of the images you've added to your catalog are in a column in the spreadsheet called 'filename', so when you do a search for "filename is IMG_1234.JPG", it is looking in the filename column for matches.

Quote
I'm thinking of writing the character returned by fbas to an unused metadata field and searching on that but wonder if there is a direct way?
That could work, I suppose, since it sounds like the "bad" images would return a dash and the good ones would return a period and you could then sort them that way. But how many ingests did this occur for? If it wasn't many, wouldn't it be simpler to just go to the folders where the problem happened and use some variation of substring extraction to chop out that piece of the data?

Offline Bob Russell

  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 276
    • View Profile
    • Camera Bits, Inc.
Re: Is it possible to search for files with sub seconds in file name?
« Reply #2 on: May 03, 2024, 10:15:17 AM »
Hi Simon,

If you rename the files with {fbas:0,17}-  then Photo Mechanic will ignore any subseconds when creating the new filenames.

If you want to search for filenames with 8 digits surrounded by a dash, then you could use the Find utility with the following RegEx string
-\d{8}-  with the grep box checked.

Best regards,

--Bob

Offline DavidHoffmanuk

  • Sr. Member
  • ****
  • Posts: 315
    • View Profile
Re: Is it possible to search for files with sub seconds in file name?
« Reply #3 on: May 07, 2024, 12:51:58 AM »
Quote
If you want to search for filenames with 8 digits surrounded by a dash, then you could use the Find utility with the following RegEx string
-\d{8}-  with the grep box checked.

This is a useful tool that I'd not been aware of. How would I change it to search for any 8 characters (not just digits) between specified delimiters?

David Hoffman
« Last Edit: May 07, 2024, 05:50:27 AM by DavidHoffmanuk »

Offline Mick O (Camera Bits)

  • Camera Bits Staff
  • Hero Member
  • *****
  • Posts: 553
    • View Profile
    • Camera Bits
Re: Is it possible to search for files with sub seconds in file name?
« Reply #4 on: May 07, 2024, 09:19:58 AM »
At the risk of being all "RTFM," I will pass along this resource for learning the ins and outs of regular expressions which make up search strings that will work with "grep" checked.  It may open up a new world of search capability for you. 

https://regexone.com/


-Mick
Mick O
Camera Bits

Offline Bob Russell

  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 276
    • View Profile
    • Camera Bits, Inc.
Re: Is it possible to search for files with sub seconds in file name?
« Reply #5 on: May 07, 2024, 10:27:22 AM »
To search for alphanumeric characters instead of digits, just change the \d to a \w. The new RegEx string would be
-\w{8}-   The underscore character is considered an alphanumeric character and will be included in the search results.

--Bob