export for external image processing - and - re-import afterwards

Started by miner1, February 19, 2015, 10:43:55 AM

Previous topic - Next topic


Hey again everybody,
I tried to figure out my issue for a while now, but didn´t find a solution so I hope that someone may help:

My project consist of app. 60.000 files, which are physically stored in folders in a hierarchically, geographical order (20 folders with many sub-, and sub-sub folders).  Most of them are Nikon RAW files (with the corresponding xmp´s and some jpg´s).
I have categorized them for my purpose.
App. 500 raw images are grouped in a category named "best of".
Due to time restrictions I will have to give these 500 raw images to an external image processing.
After editing I want these images (the filename will not change) to re-import to my database again, without losing the category assignments.
Because these images belong to many different (sub-) folders it would be very time consuming to do the "re integration" by hand.
I thought that an "export" keeping the folder structure could be one solution. So I afterwards could integrate the files back easily.
Is this possible and how could I achieve this???
Ideas are very much appreciated...



When you replace files already in your database with edited versions, IMatch will just re-import the new file but not touch category assignments.

I understand that you have organized files from dozens or even hundreds of folders in IMatch categories, You want to send these files out for editing and then replace the original files with the edited versions once the job is done.

1. You can just drag and drop files from an IMatch File Window to a folder in Windows Explorer. If you use a proper naming schema with unique names, this allows you to export all files in one go.

2. Updating existing files after the edit job is more complicated and will probably require a small script which

1. Uses the unique file name of the edited file to find the original file, in whatever folder it is
2. Copies the edited version over the original version to replace it.

This is rather easy to do, the Database scripting class has methods to Copy files and to find a file by it's name.

Another idea would be to use the Renamer to export your files, re-creating the folder structure. The Renamer has steps which Copy files, and using the proper variables you can re-create the original folder structure in the output folder used by the Renamer. This would later allow you to manually find the matching folder of the original file.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook


I have a script which does something very close to what you want.
My files are named like: 2015-02-19 123.jpg and are in a folder whose name also starts with the date.

I have a list of files (text file) which I want to move into the db, each into the correct folder.
( If I recall correctly I had accidentally (re)moved the files from the db and wanted to get them back into their right folders.)

In your case you would just look for the same file in the db, extract the folder it is in and then copy the file
from the external folder to this folder.  Not sure how a script reacts when you copy a file and it exists already?
I fear a problem there.

(Maybe the script needs to write a batch file so the files can be overwritten by Windows and not by IM themselves.)

I attach the script "Movefiles" -

[attachment deleted by admin]


Quote from: miner1 on February 19, 2015, 10:43:55 AM
Ideas are very much appreciated...


I have also not more ideas. I guess, a script would be the best way.
BTW, I guess, when you get back your nefs, you will only replace the xmp-files, not the nefs? Because usually the nefs stays exactly the same (not touched), but the edited xmp-files are the important files.

This means, you have not that lot of Megabytes to replace, only small xmps (and some jpgs).
Best wishes from Switzerland! :-)


I did some more investigating: A script which replaces a file will prompt you first.
You won't like that.

Another idea:
If you have all the files that you export available in one window you can just write a script that creates a batch
file which will later copy the files back.
Here a sample script for one file:
Dim focusedfile As File
Set focusedfile = Application.GetFileWindow(imfwtCurrent).FocusedFile
Debug.Print "COPY ";focusedfile.NameExt;"  "; focusedfile.Folder.Parent.Path;focusedfile.NameExt

You could loop over all files and later just copy/paste the script output to a batch file.


Thank you all!
because I am not very familiar with scripting (at the moment). I felt much more comfortable with Marios suggestion of using the "renaming" tool.

Copying the files back I just have to drag the topfolder (covering the complete folder structure but with the edited images) back to the folder Imatch is looking on. Windows asks me if I want to integrate the new folder into the old one. Then I have to confirm "copy and replace", refresh Imatch, and I´m done.
"Problem" was using the variable {File.path} it also adds the drive letter (G:\Users\....), but in combination with {File.Path|substr:3} I could cut of the first three letters.

Again thank you very much for your help, especially ubacher for investigating a script (can hardly believe).

[attachment deleted by admin]


Instead of using File.Path you can use the special {p0},{p1} etc. variables. These have been designed for exactly this purpose.
Details are in the Renamer help.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook


Instead of using the File Renamer to duplicate the files into a second tree, maintaining its hierarchical structure, wouldn't it be enough to simply take the top level node of the tree structure, containing all original files, and then past that somewhere else, effectively copying the original files into a new tree, but with a cloned structure? 


This is a very old post - only of interest for folks who look for similar problems.

My approach would now be to create a batch file using text export:

Move <exported NEF file name>.jpg <path to NEFfile>

assumes you get the files back as jpg files.

Once you have the files back run the resulting batch command.