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.

Using Automator to name a folder with file name

Hi all,


I read through this thread: https://discussions.apple.com/thread/4622032


It has a description and proposed solution, but I can't get the desired results. I'll restate the problem and how I'm trying to use the above solution.


I have a list of documents (.docx) in a folder, each with a unique filename. I need to take each one of those documents and put them into a folder with the same name. So, the manual work flow is:


-Select file

-Get Info and copy filename without extension

-Create new folder

-Name the folder (paste the filename)

-Move the document to the new folder


Except for getting the filename as a variable, I can do all of this with Automator's tools directly. What I can't seem to do is populate a variable with the selected file.


I do not wish to poll an entire folder's contents and generate folders for everything, but it would be great to make an arbitrary selection of files and have those be put into properly named folders.


Is there a simple Script that only capture the filename so I can pass that to Set Variable? I will eventually place this as a plugin so I can get at it from a contextual menu.


Thanks for any help!

MacBook Pro with Retina display, OS X Mountain Lion (10.8.4)

Posted on Jul 5, 2013 12:11 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 5, 2013 12:32 PM

What didn't work in the Run AppleScript action I posted in that topic? If you are just not wanting to use a script, you will need to get a couple of third part actions. I have a Get Names of Finder Items action that you can download from my Automator page, and to handle anything more than a single item you will also need something like the Dispense Items Incrementally action from automator.us.

2 replies
Question marked as Top-ranking reply

Jul 5, 2013 12:32 PM in response to lightningsymphony

What didn't work in the Run AppleScript action I posted in that topic? If you are just not wanting to use a script, you will need to get a couple of third part actions. I have a Get Names of Finder Items action that you can download from my Automator page, and to handle anything more than a single item you will also need something like the Dispense Items Incrementally action from automator.us.

Jul 5, 2013 2:29 PM in response to red_menace

I really appreciate your help, red_menace. To be honest, the script fails when I use it within Automator, and I don't know how to trap errors. All I get is "there was an error". The most likely reason is that I am not inserting it into the Automator script window properly, but without line checking and other tools I'm used to with other scripting languages, I'm just lost.


I will check out the action you referred to right now.

Using Automator to name a folder with file name

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