FORUMS: list search recent posts

Pairing raws and jpgs from different folders

COW Forums : Apple OS X

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Stefano Neri
Pairing raws and jpgs from different folders
on Jul 22, 2017 at 12:25:46 pm

Hi everybody,
Last week a customer of mine had to choose some photos from a work.
He can't manage raw, so I sent to him the jpg version of the photos : he selected a huge amount of photos (~4500).
Now I have to pair the selected Jpgs to the corresponding Raw. They've the same name (es . IMG4813.cr2 and IMG4813.jpg) and are located in two different folders.
Is there a way to automatically match them,so I could easily the files I don't need?
Actually I run on a MacBook Pro Retina,but I can also use Windows on it.
Thanks alot
Stefano


Return to posts index

John Rofrano
Re: Pairing raws and jpgs from different folders
on Jul 22, 2017 at 2:53:33 pm

[Stefano Neri] "Now I have to pair the selected Jpgs to the corresponding Raw. They've the same name (es . IMG4813.cr2 and IMG4813.jpg) and are located in two different folders. Is there a way to automatically match them,so I could easily the files I don't need?"
Sure. You can do this from a terminal windows with one command:

I assume that your client sent you a folder with just the files that they want. Otherwise, how have they selected them? So you have two different folders. One contains just the files that the customer has selected. The other contains all of the raw files. What this command will do is copy raw files from the second folder with the same name as in the first folder to a third folder. That will leave you with a new folder that has just the raw files that the customer has selected.

Open a terminal window (i.e., Launchpad | Other | Terminal). In the following example below, the raw files with the .cr2 extension are in a folder called "cr2_folder". You must change this to be the name of your folder that contains the raw files. Then make a new folder to hold just the cr2 files that are in the first. Again, in the below command I called this "new_folder". Finally change into the first folder and issue this command:

for file in *.jpg; do cp "../raw_folder/${file%.jpg}.cr2" "../new_folder/"; done

This will find all of the files in the current folder with an extension of .jpg and copy files with the same name but with an extension of .cr2 to a third folder.

Note: You must substitute the name "raw_folder" for the real name of the folder that has the raw files. Since you are issuing this command from within the first folder, I use ".." to go up a folder before specifying the second folder. You must also substitute the name "new_folder" for the real name of the folder that you created. Once again, this command is being executed from inside the folder that has the jpeg files. Leave the quotes "" in the command. The quotes are needed in case your folders have spaces in the names.

You are probably going to want to test to make sure that you have the correct paths so you can substitute the 'cp' for 'echo cp' just to print out the names. For example:

for file in *.jpg; do echo cp "../raw_folder/${file%.jpg}.cr2" "../new_folder/"; done

Will print the command that would have been executed had the 'echo' not been there.

Example with Absolute Paths
Let me give you one more example with absolute folder names just to be clear:
  • Let's say the customer files are in: /Volumes/ADATA/ClientA/good/

  • Let's say the raw files are in: /Volumes/RAID5/ClientA/raw/

  • Let's say you created your new folder at: /Volumes/RAID5/ClientA/final/

The command to accomplish this would be:

cd /Volumes/ADATA/ClientA/good/
for file in *.jpg; do cp "/Volumes/RAID5/ClientA/raw/${file%.jpg}.cr2" "/Volumes/RAID5/ClientA/final/"; done

Hopefully that gives you enough information to accomplish this. If not, ask questions.

Good Luck.

~jr

http://www.johnrofrano.com
http://www.vasstsoftware.com



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]