Script for automatically creating a file structure

Hi all,

Sorry this is my first post on this forum so I apologise if it’s in the wrong place!

I’ve been trying to create a script using Applescript/Automator in OSX 10.8.2 that automatically creates a set of files that I use on a regular basis for my client work.

The file structure I want is as follows:


  • Job Number_Job Title/ - 01. Artwork
    - 02. PDF Proofs
    - 02. Cutters
    - 04. Visuals
    - 05. OUTPUT/ - 01. To Print
    - 02. To Proto
    - 03. To 3D

Ideally I would love it if this could be set up as a simple script that could be double clicked to activate and then the script would automatically create the above folder structure in whatever finder window I have open at the time.

Thanks in advance for your assistance.

Hi,

welcome to MacScripter.

This post belongs more to AppleScript | OS X than to AppleScript Studio which is an outdated environment of Apple’s developer tools.

Try this, save the script as application, save it somewhere, and drag the application icon next to the search field in a opened Finder window



tell application "Finder" to set targetFolder to target of Finder window 1 as text
set jobNumber to getParameter for "Enter Job Number"
set jobTitle to getParameter for "Enter Job Title"
set folderStructure to "/{'01. Artwork','02. PDF Proofs','03. Cutters','04. Visuals','05. OUTPUT'/{'01. To Print','02. To Proto','03. To 3D'}}"
do shell script "/bin/mkdir -p " & quoted form of POSIX path of targetFolder & "/" & quoted form of (jobNumber & "_" & jobTitle) & folderStructure

on getParameter for prompt
	repeat
		display dialog prompt default answer ""
		set parameter to text returned of result
		if result is not "" then return parameter
	end repeat
end getParameter

That is exactly what I was looking for! Thank you so much for your speedy response!

Hi! This is great! How hard would it be to edit this to include the job name into each subfolder title?

At which position?