bocciaman

Folder Creation

Sep 21st, 2021
695
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. property newFolderName : "Project Folder"
  2. property subFolderNames : {"photos", "footage", "thumbnails", "tags"}
  3.  
  4. repeat
  5.     display dialog "Enter Project Name:" default answer ""
  6.     set jobNumber to text returned of result
  7.     if result is not "" then exit repeat
  8. end repeat
  9.  
  10. choose folder with prompt "Create job folder '" & jobNumber & "' in this folder:"
  11. try
  12.     tell application "Finder"
  13.         make new folder at result with properties {name:(jobNumber & " " & newFolderName)}
  14.         set jobFolder to result
  15.        
  16.         repeat with i from 1 to (count subFolderNames)
  17.             make new folder at jobFolder with properties {name:(jobNumber & " " & (item i of subFolderNames))}
  18.         end repeat
  19.     end tell
  20. on error errorMsg number errorNum
  21.     display dialog "Error: (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1
  22. end try
RAW Paste Data