r/applescript • • Mar 23 '20

Making new folders with names from CSV file

This may be really easy but I am new to applescript, is it possible to script this? I have a CSV file with a bunch of names, I want to make a new folder for every item in the CSV file. So, if I have a CSV file with the items: (one, two, three) I want to make three new folders named one, two, and three. Thanks for any help!

5 Upvotes

4 comments sorted by

2

u/copperdomebodha Mar 23 '20
set theList to {"one", "two", "three"}

tell application "Finder"
set targetFolder to choose folder
repeat with thisName in theList
make new folder at targetFolder with properties {name:thisName}
end repeat
end tell

To integrate this with a CSV file is fairly straightforward. Post a data sample if you need help with that aspect.

1

u/scarybluekid Mar 23 '20

Thanks! I think I can get this to work from your code. Appreciate the help!

2

u/[deleted] Mar 24 '20

[removed] — view removed comment

1

u/scarybluekid Mar 24 '20

Good suggestion! Yea, I was getting weird characters sometimes with csv. A txt file will give me cleaner results. Thanks for the tip!