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.

Script (or App) to create folders from filenames (and vice versa?)

I am managing a project to sort and manage images/files in a specific way. It starts with selecting 1000s of images for a resource library, saving the original filename into metadata (so it can be accessed in the future if needed), then categorizing and keywording in Lightroom or Bridge for our specific needs. Once done I sort into a folder structure to process the renaming of all the files... which brings me HERE. :)


I would like to use Applescript, automator, or anything other than TERMINAL. Having a friendlier UI will help me to get others to use the process too, so a droplet or folder action could work.


STAGE 1: Folders to Filenames

identify and sort image files by topic and keywords as folder names

Using an app I have been able to do this but it could be more streamlined. There is usually a TOPIC folder and then keywords describing the image. If a keyword is used frequently it may become a subfolder/category or keywords just separated by hyphens. It currently creates files missing levels because the app sees 2 levels, if there is a 3rd or 4th it omits the keyword and enters just the hyphen. So I find all those and run them again. It would be great if it could identify all sublevels in one pass and know that they've all been addressed.


TOPIC1

keyword1

keyword2-keyword3

originalfilename.jpg


RENAME RESULT: TOPIC1-keyword1-keyword2-keyword3.jpg


STAGE 2: Moving (or keeping) the files at the TOPIC level OR creating folders based on the filename

I have done this manually, selecting all my final files that begin with TOPIC1 and moving them to that directory level and then deleting the now empty "keyword" level folders. The renaming app I used for stage 1 doesn't move files.


IDEA/SOURCE

I found this script and it works well for the Stage 2 process EXCEPT I can't get it to work with my hyphen separator instead of the backslash "/" the original requestor used. I realize this is probably an easy fix for those using Applescript a lot but I only have used it a handful of times over the years.


Create Folders from Filenames - Apple Community


Open to ideas and options.

This is a semi-annual task and would love to remove the manual tasks as much as possible. It would also alleviate me from having to "backup" each step result in case of an error. Frustrating to find 2 or 3 exceptions appear and make you wonder if the other 1000s of files are named correctly.

MacBook Pro (M1, 2020)

Posted on May 15, 2024 9:38 AM

Reply
3 replies

May 15, 2024 5:07 PM in response to Yer_Man

Thanks for the reply. You may be right but I run into different issues. If I use the same folder structure noted above... the FILE RENAME option only brings the parent folder name... it doesn't pull multiple levels in. At least I have not find a way. Some of the other functions are helpful though.


I think I can use the "Label" metadata field to identify the TOPIC and bring that to the name. I will have to see what can be done about the multi-leveled folder structure. If there aren't many, I may be able to make that switch.

Script (or App) to create folders from filenames (and vice versa?)

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