Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do i get the first 3 letters of the parent folder im creating a folder in with automator

im designing a Automator service to create a project folder in the folder of a client and I want to append the first three letters of that clients folder name to the next folder.

Client folder: Coca-Cola > new project_COC how do i append the first three letters of Coca-Cola (COC) in capital to the new folder.

share|improve this question
up vote 3 down vote accepted

As an Example on how to get the 3 chars.:

You can get the details from some unix code that gets the folder name from parents path and gets the first 3 letters and transforms it into upper case.

Passes it on to the storage var. to use in the Make folder or what ever you use.

enter image description here

for f in "$@"
    sufx=`basename "$f" |cut -c-3 | tr "[a-z]" "[A-Z]"`

echo _"$sufx"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.