Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create multiple folders from Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create multiple folders from Terminal
Authored by: BobHarris on Apr 25, '06 04:07:59PM
-- AppleScript wrapper to execute UNIX shell scripts with a drag and drop interface.
-- Found basic script at http://MacOSXHints.com
-- Modified to Create directories from a list stored one per line in a file dropped on the script
-- script should handle spaces in name, apostrophes in names, etc...
-- Bob Harris	25-Apr-2006

on open filelist
	repeat with dir in filelist
		do shell script ¬
			"while read dir;do mdir -p \"$dir\";done <" & quoted form of POSIX path of dir
	end repeat
end open


[ Reply to This | # ]
Create multiple folders from Terminal
Authored by: osxpounder on Apr 26, '06 12:36:26PM

Bob: your kind offer of an Applescript was appreciated. It didn't compile for me, though. It breaks at the $ sign, saying "Syntax error Expected end of line but found unknown token".

---
--
osxpounder



[ Reply to This | # ]
Create multiple folders from Terminal
Authored by: osxpounder on Apr 26, '06 12:46:50PM

I thought I found a typo or two, so I changed Bob's script a bit, but still no results. I changed the quotes around $dir to single quotes, and that allowed the script to compile, but it did nothing. I saved it as an app and dropped a plain text file, with names, one per line, on it.

I changed "mdir" to "mkdir", but that made no difference, either.

---
--
osxpounder



[ Reply to This | # ]
Create multiple folders from Terminal
Authored by: BobHarris on Apr 26, '06 02:49:55PM

This is my 3rd attempt at getting this Applescript posted cleanly. First I lost the < because it looked like the start of an html tag. The 2nd time I lost the \'s and messed up the mkdir spelling. This time I'm just going to use Plain Old Text, and the heck with indentation and hope that line wrapping doesn't happen


-- AppleScript wrapper to execute UNIX shell scripts with a drag and drop interface.
-- Found basic script at http://MacOSXHints.com
-- Modified to Create directories from a list stored one per line in a file dropped on the script
-- script should handle spaces in name, apostrophes in names, etc...
-- Bob Harris 25-Apr-2006

on open filelist
repeat with afile in filelist
do shell script "while read DIR;do mkdir -p \"$DIR\";done <" & quoted form of POSIX path of afile
end repeat
end open



[ Reply to This | # ]