create directory

How can I create directory? I have a 200 directory that i want to create. All of directory name that I want to create is in the file name "list".
Please help
teeraAsked:
Who is Participating?
 
MysidiaCommented:
Special characters in the directory names like space and '  (single quote,
or apostrophe) throw it off and need to be escaped.

try  starting with:

cat list |sed "s/ /\\ /g;  s/'/\\'/g" |xargs mkdir
0
 
MysidiaCommented:
mkdir (dirname)


What does "list" look like?

if it's a list of just directory names one per line, you could use something like

cat list |xargs mkdir

to make your directories
0
 
teeraAuthor Commented:
it show    
xargs: un match single qouat

List file is like this

Aloha Resort & Spa
Al's Hut Bungalow
Al's Resort
Amadeus Bungalow
Amari Palm Reef Resort
Amity Bungalow
Anchor House Bungalow
Anong Villa
Ar-An Resort
Arayaburi Boutique Resort
Aree Bungalow
Ark Bar Garden Beach Resort
Axolotl Village
Baan Chaweng Resort
Baan Haad Ngam Boutique Resort & Spa
0
 
sunnycoderCommented:
The error might be due to the single ' in Al's

You need to preprocess the file to escape all ' with a \

sed "s/'/\\\'/" name > name.new
0
 
byttaCommented:
just use quotes or  around each line - it covers everything (except quotes and $,! )...

to modify Mysidia's version (^and $ are start/end of each line):
cat ../list |sed -e  "s/^/\"/g;s/$/\"/g" | xargs mkdir  

to escape quotes too:
cat ../list |sed -e  "s/\"/\\\"/g; s/^/\"/g;s/$/\"/g"  | xargs mkdir  
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.