[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

create directory

Posted on 2005-05-10
5
Medium Priority
?
233 Views
Last Modified: 2012-05-05
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
0
Comment
Question by:teera
5 Comments
 
LVL 23

Expert Comment

by:Mysidia
ID: 13966298
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
 

Author Comment

by:teera
ID: 13966330
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
 
LVL 45

Assisted Solution

by:sunnycoder
sunnycoder earned 400 total points
ID: 13966611
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
 
LVL 23

Accepted Solution

by:
Mysidia earned 400 total points
ID: 13966632
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
 
LVL 4

Assisted Solution

by:bytta
bytta earned 400 total points
ID: 13985551
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
This article will show you step-by-step instructions to build your own NTP CentOS server.  The network diagram shows the best practice to setup the NTP server farm for redundancy.  This article also serves as your NTP server documentation.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month18 days, 3 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question