|
|
Create multiple folders from Terminal
Sorry, in the previous post some crucial backslashes vanished as a consequence of the html coding. Here I'll try again:
Create multiple folders from Terminal
Ah, but what if they have Double Quotes or Single Quotes in their names? How would one deal with that?
Create multiple folders from Terminal
To not care about spaces, quotes, etc, and the name of dirs is in folders.txt:
Create multiple folders from Terminal
and _that's_ why I love perl.
Create multiple folders from Terminal
perl, perl, what a nightmare.. !!!!
You should use
perl -ne 'chomp($x=$_); mkdir($x);' < dirnames.txtand the utf8 accented etc chars are not welcome :(
Create multiple folders from Terminal
There's no need for the chomp if you use the lowercase L switch. There's no need for the parens, semicolon, or redirection either.
Create multiple folders from Terminal
Doesn't do a thing for me. Not even an error.
Create multiple folders from Terminal
I was referring to the first perl command, when I said it did nothing for me, but I'll add that the second perl command also did nothing. If I just run "perl" on the command line, I see a process in Activity Monitor, so it's not that I lack perl.
Create multiple folders from Terminal
Then something's fishy: I made a text file "dirnames.txt" in my home directory with the contents
Create multiple folders from Terminal
This one did nothing but gave me an error: "Wilson Mug-Base.jpg: File name too long" Hmm. Is that because the file name had a space in it? I thought the point of the awk trick was that it would work with items that had spaces in their names. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.10 seconds |
|