There are probably a few utilities out there, but an AppleScript or Automator workflow can be used. Assuming just the name in each record in the csv text file, an
AppleScript to do this would be:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px; height: 340px;
color: #000000;
background-color: #DAFFB6;
overflow: auto;"
title="this text can be pasted into the AppleScript Editor">
on run -- make new folders from names in a text file
(*
makes new folders at the destinationFolder using names from the inputFile text file
if useExistingFolders is set to false, a number suffix is added to the name if the folder exists
the colon (:) is illegal for Finder names, but can be used to specify subfolders
*)
set useExistingFolders to false -- use folders that already exist?
set inputFile to missing value -- set the source text file path here
try
set inputFile to inputFile as alias
on error
set inputFile to (choose file with prompt "Choose a text file containing folder names:")
end try
set destinationFolder to missing value -- set the destination folder path here
try
set destinationFolder to destinationFolder as alias
on error
set destinationFolder to (choose folder with prompt "Choose a destination folder for the new sub folders:")
end try
repeat with anItem in paragraphs of (read inputFile)
set anItem to anItem as text
if anItem is not "" then -- skip blank items
set targetFolder to destinationFolder
set {tempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
set {nameList, AppleScript's text item delimiters} to {text items of anItem, tempTID}
repeat with theName in nameList -- deal with sub folders
if not useExistingFolders then set theName to (getUniqueName for theName from targetFolder) -- avoid duplicate names
try
tell application "Finder"
make new folder at targetFolder with properties {name:theName}
set targetFolder to (the result as alias)
end tell
on error number -48 -- folder already exists
set targetFolder to ((targetFolder as text) & theName) as alias
end try
end repeat
end if
end repeat
end run
to getUniqueName for someName from someFolder
(*
check if someName exists in someFolder, creating a new unique name if needed
parameters - someName [text]: a name.extension to check for
someFolder [mixed]: a folder to check
returns [text]: a unique name
*)
set {counter, divider} to {"00", "_"}
set here to -(offset of "." in ((reverse of text items of someName) as text)) - 1
set theName to text 1 thru here of someName
if here is -1 then -- no extension
set theExtension to ""
else
set theExtension to text (here + 1) thru -1 of someName
end if
set newName to theName & theExtension
tell application "System Events" to tell (get name of items of folder (someFolder as text))
repeat while it contains newName
set counter to text -2 thru -1 of ((100 + counter + 1) as text) -- leading zero
set newName to theName & divider & counter & theExtension
end repeat
end tell
return newName
end getUniqueName
</pre>
For an
Automator solution, I have a
Make New Folders from Text Items action that basically does the same thing. An example workflow would be:
1) *Ask for Finder Items* -- get the text file(s)
2) *Combine Text Files* -- get the text
3) *Filter Paragraphs* { Return paragraphs that are not empty }
4) *Make New Folders from Text Items*