This AppleScript streamlines folder creation by prompting users for the number of folders, a base name, and a destination location. It then automatically creates sequentially numbered folders in the chosen directory, simplifying organization and file management on macOS.
Click to view script…
-- Ask the user how many folders they want to create
set folderCountString to text returned of (display dialog "How many folders do you want to create?" default answer "1")
try
set folderCount to folderCountString as integer
on error
display dialog "Please enter a valid number."
return
end try
-- Ask for a base name for the folders
set baseName to text returned of (display dialog "Enter a base name for your folders:" default answer "Folder")
-- Let the user choose the target location (e.g., Desktop, Documents, Downloads, etc.)
set targetFolder to choose folder with prompt "Choose the folder where the new folders will be created:"
-- Create the folders
tell application "Finder"
repeat with i from 1 to folderCount
set folderName to baseName & " " & i
try
make new folder at targetFolder with properties {name:folderName}
on error errMsg number errNum
display dialog "Error creating folder \"" & folderName & "\": " & errMsg
end try
end repeat
end tell
display dialog "Successfully created " & folderCount & " folder(s) in " & (targetFolder as text)