Just how do I make numerous directory sites simultaneously in a directory site?

I recognize with mkdir I can do mkdir A B C D E F to create each directory site. Just how do I create directory sites A-Z or 1-100 with out keying in each letter or number?

0
2019-05-05 18:43:50
Source Share
Answers: 4

It's possibly most convenient to simply make use of a for loop :

for char in {A..Z}; do
    mkdir $char
done

for num in {1..100}; do
    mkdir $num
done

You require at the very least bash 3.0 though ; or else you need to make use of something like seq

0
2019-05-08 12:09:56
Source

On Linux you can create series of figures with the "seq" command, yet this does not feed on all Unix systems. As an example to create directory sites from 1 to 100 :

mkdir `seq 1 100`

While you can absolutely make directory sites A to Z with shell utils :

seq 65 90 \
    | while read foo; do printf "%b\n" `printf '\\\\x%x\n' $foo`; done \
    | xargs mkdir

It's possibly a whole lot much less hideous to simply make use of Perl :

perl -e 'foreach (ord "A"..ord "Z") { mkdir chr $_ }'
0
2019-05-08 12:07:47
Source

The {} syntax is Bash syntax not linked to the for construct.

mkdir {A..Z}
.

suffices all on its own.

http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion

0
2019-05-08 11:58:42
Source

You can additionally do even more intricate mixes (attempt these with echo as opposed to mkdir so there's no cleaning after that ) :

Compare

$ echo pre-{{F..G},{3..4},{m..n}}-post
pre-F-post pre-G-post pre-3-post pre-4-post pre-m-post pre-n-post
.

to

$ echo pre-{F..G}{3..4}{m..n}-post
pre-F3m-post pre-F3n-post pre-F4m-post pre-F4n-post pre-G3m-post pre-G3n-post
pre-G4m-post pre-G4n-post
.

If you have Bash 4, attempt

$ echo file{0001..10}
file0001 file0002 file0003 file0004 file0005 file0006 file0007 file0008 file0009
file0010
.

and also

$ echo file{0001..10..2}
file0001 file0003 file0005 file0007 file0009
.
0
2019-05-08 00:29:55
Source