[Solved] how to create multiple directory in one mkdir command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] how to create multiple directory in one mkdir command
# 1  
Old 05-11-2011
[Solved] how to create multiple directory in one mkdir command

Hi, Unix Gurus,
- I have a simple question, I need create multiple directory. I use
Code:
mkdir {dir1, dir2, dir3)

I got one directory as
Code:
{dir1, dir2, dir3}

I searched @ google, I got answer as above code.SmilieSmilie

Anybody has any idea

Thanks in advance

---------- Post updated 05-11-11 at 09:26 AM ---------- Previous update was 05-10-11 at 10:31 PM ----------

Its is typo, don't put space between directory name.
Code:
mkdir {a,b,c}          right format

dont put
Code:
mkdir {a, b, c}


Last edited by pludi; 05-11-2011 at 04:10 AM..
ken002
# 2  
Old 05-11-2011
Why complicate it when you can do...
Code:
mkdir dir1 dir2 dir3

unless there is constraints on the dirs.
This User Gave Thanks to shamrock For This Post:
# 3  
Old 05-11-2011
Simple example:
Code:
mkdir -p /backup/{2008,2009,2010}/{01,02,03,04,05,06,07,08,09,10,11,12}/

A lot less typing.
This User Gave Thanks to pludi For This Post:
# 4  
Old 05-11-2011
Learnt something very nice today. Thanks people.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create a long list of directories with mkdir?

Hi... Thanks to read this... I want to use mkdir to create many directories listed in a text file, let's say. How do I do this? Sorry for this maybe very basic question :) (13 Replies)
Discussion started by: setub
13 Replies

2. UNIX for Dummies Questions & Answers

Mkdir a/b/c # where a/b does not exists. is it possible to create it ?

Is is possible to create the directories in following manner. for example my home dir is empty and i want to create dir a/b/c mkdir a/b/c # where a/b does not exists. (5 Replies)
Discussion started by: anandgodse
5 Replies

3. Red Hat

Mkdir: cannot create directory `/home/phpmy/html': Permission denied centos

for incompatibility installation problems, I've decided to reinstall Centos 6.3 as can be seem from the df output, I've partitioned both / and and /home directories $ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda8 12G 5.3G 6.5G 45% / tmpfs ... (2 Replies)
Discussion started by: jediwannabe
2 Replies

4. Shell Programming and Scripting

[Solved] Sed error - multiple number options to `s' command

Hi All, I am having two files (file1 & file2) and a filelist.txt file below. file1: $$STRINGVAR1=5 $$STRINGVAR2=10 $$LAST_UPD_DT_TBL1=12/12/2010 12:00:00 $$STRINGVAR3=100 $$LAST_UPD_DT_TBL2=01/01/2010 12:00:00... (8 Replies)
Discussion started by: Chandru_Raj
8 Replies

5. Shell Programming and Scripting

mkdir home directory

Is there a way to create a directory in home directory through a bash script? And if yes then the files we want to put in there have to be put by the time is created in the bash script? (3 Replies)
Discussion started by: vlm
3 Replies

6. Linux

mkdir command

Hi all, i am new to Linux and need some help. I used the command: mkdir super Directory super is created When i try to change to this directory using: cd /super I get: bash: cd: /super: No such file or directory when i use: rm super I get: rm: cannot remove 'super': Is a directory What... (5 Replies)
Discussion started by: Deside
5 Replies

7. UNIX for Dummies Questions & Answers

mkdir: cannot create directory `/builds/somedir/': Permission denied

Hi, I am trying to run a shell script which contains an mkdir command as part of the execution. The script fails with the following error: mkdir: cannot create directory `/builds/somedir/': Permission denied The user running the script is 'harry' and belongs to group 'school'.... (5 Replies)
Discussion started by: Technext
5 Replies

8. UNIX and Linux Applications

mkdir: cannot create directory

Hi, I have network mount on two servers. One server I can create any directories without any issues, other server with the similar mount, I am not able to create directories starting with number! Creation, name start with a number: $ mkdir 1212 mkdir: cannot create directory `1212': No such... (12 Replies)
Discussion started by: ./hari.sh
12 Replies

9. Shell Programming and Scripting

How to create multiple list of files in a directory ?

Hi, i have say 100 files in a directory. file1.log file2.log file3.log file4.log file5.log file6.log ... ... ... file99.log file100.log ========= I need to create another file which contains the list of al these log files. each file should contain only 10 log file names. it shud... (4 Replies)
Discussion started by: robinbannis
4 Replies
Login or Register to Ask a Question