Applescript to find file name matches and move files

Spread the love


A photographer friend has a workflow where they move and save all NEF files (original raw files from Nikon camera) to a folder. Then they use Lightroom to import the files from the camera which converts them to DNG files (digital raw file format). The imported files are stored in a different location on the hard drive.
The file name for both NEF and DNG file is the same, of course.

I am looking for a script that can run periodically to

  1. loop through the folder with the NEF files
  2. For each item, use the file name (without extension) and search through a destination folder including subfolders for a matching file with the same name.
  3. If a match was found, then skip and go to the next item, otherwise move the input file (the NEF file) to a new location

The objective is that as files in Lightroom are assessed and deleted (only a fraction are kept), the corresponding NEF files for those files that were removed are put into a separate location for review before deleting them. The outcome should be that the original folder for NEF files only contains files where a matching file name without extension is also found in the file location that Lightroom uses for the imported (and kept) file.

Author: Dhanraj7978

Leave a Reply

Your email address will not be published. Required fields are marked *