Hi
I want to write a small script that will create folders named from `AAAA' all the way to `ZZZZ'.
That is:
`AAAA'
`AAAB'
`AAAC'
...
`AABA'
`AABB'
`AABC'
...
`ABAA'
`ABAB'
`ABAC'
...
`ABBA'
...
`ZZZZ'
Any ideas?
Hi
I want to write a small script that will create folders named from `AAAA' all the way to `ZZZZ'.
That is:
`AAAA'
`AAAB'
`AAAC'
...
`AABA'
`AABB'
`AABC'
...
`ABAA'
`ABAB'
`ABAC'
...
`ABBA'
...
`ZZZZ'
Any ideas?
Example for bash
for i in {A..Z}{A..Z}{A..Z}{A..Z};do mkdir $i;done
Sorry I'm a complete novice and may have done something wrong. I tried exactly what you had written above. It only seems to create a folder title `{A..Z}{A..Z}{A..Z}{A..Z}'.
Update
I realized it would be easier to do this with numbers (the names of the folders don't matter to me as long as they're sequential), so I wrote this:
for ((i = 0; i <= 9; i++))
do
for((j = 0; j <= 9; j++))
do
for((k = 0; k <= 9; k++))
do
for((l = 0; l <= 9; l++))
do
for((m = 1; m <= 9; m++))
do
mkdir "$i$j$k$l$m" #This will create the folders
done
done
done
done
done
Hi.
The solution from danmero works perfectly (in bash, ksh and in csh).
If you want to use numbers, this would be quicker I tbink:
printf "%04d\n" $(seq 0 9999) | xargs -I{} mkdir {}
(you should - but may not - have seq on your system!)
Why do you have five for loops? If hope you have 100,000 free inodes!
$ cat filename.pl
for (AAAA..ZZZZ) {
mkdir $_;
}
The above perl script will do, store and run it as
$ perl filename.pl
Or run from your command line itself.