Author Topic: Data recovery: can PM mass-rename XMP files to match them with NEFs, etc.  (Read 5027 times)

Offline jposhea3

  • Newcomer
  • *
  • Posts: 3
    • View Profile
Friends,

Running PM 4.6.6 on Intel macs running Snow Leopard OS X 10.6.5

I am restoring files after a malware-induced mass-delete. ['backup' comments to /dev/null please]

The restoration recreates the files as sequentially numbered items. 1.jpg, 2.jpg, 3.psd, 3.nef, etc.

'Normally' the XMP files associated with Photoshop and Lightroom are matched by filename with the name of the image file.

I tend to name my files using a location name for a shoot followed by the variables {dats}_{tmsl} to get them uniquely identified by time-shot.

This time-specific data appears to be present in the XMP file as well, but I cannot identify a PM variable that refers to data *inside* XMP files that could be used to rename those files.

Thus if I took all the PSDs and selected them in PM, I could rename them all,say, recovered_{dats}_{tmsl}.nef/psd/jpg/tiff/etc

I would then like to take all the xmp files and rename them, similarly, such that lightroom, photoshop, etc would see them as paired files once again.

Is there a way to handle this renaming of XMP files in PM?

I'm thinking of items in the XMP such as these (to the extent that they have analogous Variable names currently available for the image files themselves):

 <photoshop:DateCreated>2009-11-12T18:29:02Z</photoshop:DateCreated>

<xap:ModifyDate>2009-11-12T18:29:02.58Z</xap:ModifyDate>

   <xap:CreateDate>2009-11-12T18:29:02.58Z</xap:CreateDate>

 <xap:MetadataDate>2009-11-30T21:21:34-05:00</xap:MetadataDate>


Apologies if my search of the forums didn't uncover this as an already-asked-and-answered question.

Thanks
-james

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
James,

Running PM 4.6.6 on Intel macs running Snow Leopard OS X 10.6.5

I am restoring files after a malware-induced mass-delete. ['backup' comments to /dev/null please]

The restoration recreates the files as sequentially numbered items. 1.jpg, 2.jpg, 3.psd, 3.nef, etc.

'Normally' the XMP files associated with Photoshop and Lightroom are matched by filename with the name of the image file.

I tend to name my files using a location name for a shoot followed by the variables {dats}_{tmsl} to get them uniquely identified by time-shot.

This time-specific data appears to be present in the XMP file as well, but I cannot identify a PM variable that refers to data *inside* XMP files that could be used to rename those files.

Thus if I took all the PSDs and selected them in PM, I could rename them all,say, recovered_{dats}_{tmsl}.nef/psd/jpg/tiff/etc

I would then like to take all the xmp files and rename them, similarly, such that lightroom, photoshop, etc would see them as paired files once again.

Is there a way to handle this renaming of XMP files in PM?

I'm thinking of items in the XMP such as these (to the extent that they have analogous Variable names currently available for the image files themselves):

 <photoshop:DateCreated>2009-11-12T18:29:02Z</photoshop:DateCreated>

<xap:ModifyDate>2009-11-12T18:29:02.58Z</xap:ModifyDate>

   <xap:CreateDate>2009-11-12T18:29:02.58Z</xap:CreateDate>

 <xap:MetadataDate>2009-11-30T21:21:34-05:00</xap:MetadataDate>

PM does not parse 'orphaned' XMP files: they're treated as 'unknown' files and their metadata is not parsed at all.  I don't have any other suggestions for you at this time.

I'm sorry.

-Kirk

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Ok, here's a wild thing to try:

0. Make a copy of everything so you can go back if below steps fail.
1. Separate the XMP's from the other (image) files.
2. Try to rename all your image files based on the information therein. As you already found this seems to work.
3. Now the tricky part: try to get your XMP's to be renamed correctly based on the information contained therein.
3a. Have a matching dummy raw file for EACH .xmp file
3b. Now try to rename those dummy files and instead of date/timeshot use a combination of the various iptc date fields {iptcyear}{iptcmonth}{…}
4. move the new .xmp files to where you had your image files and they should match (use different renaming patterns to make files unique) :)

I did a little testing and this seems to  work (assuming you have the iptc date set to the date shot, the default). The hardest part should then actually getting a (dummy) raw file for each .xmp file, but that shouldn't be too hard either using a bit of command-line scripting.

Hope this helps,
    Hayo
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline jposhea3

  • Newcomer
  • *
  • Posts: 3
    • View Profile
Thanks, you actually just triggered an idea when you closed, almost in passing, saying 'some scripting' - I realized but didn't *absorb* that the xmp file is plaintext, and some unix shell scripting could extract the line I wanted, and then some string manipulation could get me to a matching yyyymmdd etc format.

But, looking again at the xmp contents, what does one really 'lose' if I recover all the NEFs and PSDs but don't get the accompanying XMP files? What 'bad thing' happens if I don't get the xmp's back and matched to their proper raw/photoshop file?

ratings (stars, flags in lightroom accept/reject/none)?
color labels?
white balance changes in CameraRaw?

or nothing that Lightroom/bridge/cameraraw can't readily recreate? (ie no big deal)

thanks to all -- I also tried looking at ExifRenamer to see if it referred to the CreateDate field inside, but not directly, I've queried the author.

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
The extent of information you are likely to lose fully depends on what your IPTC preferences in PhotoMechanic were and what software you used to edit your files (e.g., Lightroom, Photoshop, Capture NX, …) and/or whether or not you used them to alter the IPTC info.

However, since you have .xmp files my guess is you used Adobe software to at least edit your raw files (and perhaps alter the IPTC as well). In this case it is absolutely vital you retain the match between the .xmp and the raw file as all your edits are stored in the .xmp and not in your raw file…

If you are handy with scripting, this may actually be the simplest way to rename the .xmp files to match the raw files you renamed with PM.

Good luck!
    Hayo
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline jposhea3

  • Newcomer
  • *
  • Posts: 3
    • View Profile
Latest update: found a tool called ExifTool from a gent in Canada. It has DateCreated as a native token that you can trivially use from the command line to rename the file, the only caveat is it doesn't go past whole seconds, and there are some formatting tweaks to get the equivalent of 'datsl' and 'tmsl' PM variables.

But that should just be a little Perl or other scripting work to get the files renamed.

Let's hope all the XMPs find NEFs to pair with, and all the NEFs get found! :-)

Thanks for your help! I'll put an update out when I finally get it all sorted.