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.

How to use the bash script for directory structure in Automator?

The Brief:

I'm trying to make a directory structure using Automator on mac Automator screenshot

and using this bash script


mkdir -p "$1/$2/Client_Name_Social_Media/01_January_2020/Design/Deliverables"


The Problem:

I need to add the Client_name before every directory name. I have many

clients, and I don't want to waste my time renaming the directories.


Ultimate directory structure:

• Client_Name

• Client_Name_Social_Media

• Client_Name_Month

• Client_Name_Calendars

• Client_Name_Design

• Client_Name_OpenFiles

• Client_Name_Deliverables

• Client_Name_Campaigns


Thank you in advance

MacBook Pro 15", macOS 10.15

Posted on Feb 12, 2020 12:38 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 12, 2020 3:57 AM

Given your existing workflow, here is the Bash content to produce the following structure. The client name is Siba, and the startat folder location is ~/Desktop/TestX. All folder order is disabled for TestX, and what you see is Finder default ordering:



DIR="$1"
CLIENT="$2"
TMONTH="$(date -j +%d_%B_%Y)"

mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Social_Media/${CLIENT}_${TMONTH}/${CLIENT}_Calendars
mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Social_Media/${CLIENT}_${TMONTH}/${CLIENT}_Design/${CLIENT}_OpenFiles
mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Social_Media/${CLIENT}_${TMONTH}/${CLIENT}_Design/${CLIENT}_Deliverables
mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Campaigns


Similar questions

3 replies
Question marked as Top-ranking reply

Feb 12, 2020 3:57 AM in response to jbm8915

Given your existing workflow, here is the Bash content to produce the following structure. The client name is Siba, and the startat folder location is ~/Desktop/TestX. All folder order is disabled for TestX, and what you see is Finder default ordering:



DIR="$1"
CLIENT="$2"
TMONTH="$(date -j +%d_%B_%Y)"

mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Social_Media/${CLIENT}_${TMONTH}/${CLIENT}_Calendars
mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Social_Media/${CLIENT}_${TMONTH}/${CLIENT}_Design/${CLIENT}_OpenFiles
mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Social_Media/${CLIENT}_${TMONTH}/${CLIENT}_Design/${CLIENT}_Deliverables
mkdir -p ${DIR}/${CLIENT}/${CLIENT}_Campaigns


How to use the bash script for directory structure in Automator?

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