You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Move files from parent folder to correct subfolder with same file names

Hi, I’m new to Automator but I wanted to see if there’s a way to do the following.


I have a single folder with over 5000 images (.tif) - these are the newer edited images.


I have another folder with subfolders of the same 5000+ images distributed - but these are the old file edits.


I need to move all the new images to the correct subfolder, I've been doing that by opening each subfolder from the old image files, and search the matching file name from the new folder containing the new images then copying and overwriting the photos.


Is there a way to speed up this process using an apple script?

Posted on Dec 20, 2022 2:33 PM

Reply

Similar questions

3 replies

Dec 23, 2022 1:55 PM in response to shavarfieldstone

Hi shavarfieldstone


I have divided my answers and tips into 3 parts. You can get more detailed help for your own applescript creation in the Macscripter forum (https://www.macscripter.net).

To place or move image files into subfolders, you can use the script from Hilfdirselbst.ch as a starting point (Part 1). With an additional script command you can then also overwrite existing images. In the current script, a new subfolder is simply created.

With NameMangler you can use a lot of renaming options that e.g. a "NameChanger" does not have (Part 3). The purchase of this program is really worth it.


Part 1:

Image-matching-with-applescript


Part 2:

Encapsulate files in folder with the same name


Part 3:

Add-filename-with-folder-name



Dec 20, 2022 4:43 PM in response to shavarfieldstone

Hi shavarfieldstone


You have a folder B with 5000 images, which were converted and a folder A, with various subfolders, where the old images are.

Wouldn't it be easier in your case, if you first remove all subfolders in folder A with the Automator or an Applescript, then copy the new images from folder B into folder A and overwrite them, and finally create subfolders again manually or e.g. with an Applescript?

Otherwise the execution of the script will take too long, if you have to query all subfolders for each image file first, where the duplicate would be located. Of course this is possible, but cumbersome.


When resolving all subfolders, you still have to catch the case that images can have the same name and then have to rename them.

By means of the tool Hazel you can already simplify a lot. https://www.noodlesoft.com/manual/hazel/advanced-topics/processing-subfolders/.

You can delete all subfolders in a folder with this script: https://macscripter.net/viewtopic.php?id=34633

Dec 21, 2022 9:40 AM in response to Andi_Vo

Hi Andi_Vo


Wouldn't it be easier in your case, if you first remove all subfolders in folder A with the Automator or an Applescript, then copy the new images from folder B into folder A and overwrite them, and finally create subfolders again manually or e.g. with an Applescript?


Unfortunately, there are 853 subfolders with about 3-5 images in each. The challenging part about manually creating the subfolders again is finding the correct image files to place in the folders. Currently, the images are named in a numerical and nonconsecutive format therefore subfolder1 would contain images: 0048, 2395, 1032, 0068, and subfolder2 would contain 4983, 1009, 5657... etc.


Do you know if there's a way to add the subfolder name to the end of all my image file names? for example, one of my subfolder is named:

Carolina Fanwort Cabomba caroliniana

0084_NASWIL_ISBN_art_r1.tif

0193_NASWIL_ISBN_art_r1.tif

1007_NASWIL_ISBN_art_r1.tif

1008_NASWIL_ISBN_art_r1.tif


I want to rename the files

Carolina Fanwort Cabomba caroliniana

0084_NASWIL_ISBN_art_r1/Carolina Fanwort Cabomba caroliniana.tif

0193_NASWIL_ISBN_art_r1/Carolina Fanwort Cabomba caroliniana.tif

1007_NASWIL_ISBN_art_r1/Carolina Fanwort Cabomba caroliniana.tif

1008_NASWIL_ISBN_art_r1/Carolina Fanwort Cabomba caroliniana.tif


If theres a way to do this, then I can easily identify the correct images for each subfolder



Move files from parent folder to correct subfolder with same file names

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.