I am making nested directories using a command like this:
mkdir -p 1/2/3/4
However, for many nested directories it takes too much time.
If I want to create 100 directories, what should I do?
I am making nested directories using a command like this:
mkdir -p 1/2/3/4
However, for many nested directories it takes too much time.
If I want to create 100 directories, what should I do?
You can run:
mkdir -p $(printf "%s" {1..100}/)
where brace expansion is used with /
as the optional <SUFFIX>
parameter.
You could use a for loop:
#!/bin/bash
p=''
for i in {1..100}; do
p+=$i/
done
mkdir -p "$p"