LoginSignup
1
1

More than 1 year has passed since last update.

一気にディレクトリ / ファイルを作成するLinuxコマンド

Posted at

やり方

  • ディレクトリ(単一階層)
mkdir {a,b,c,d,e}

結果

ls
a/ b/ c/ d/ e/
  • ディレクトリ(複数階層)
# mkdir -p {a,b,c,d,e}/{e,f}

結果

find .
.
./a
./a/f
./a/e
./c
./c/f
./c/e
./d
./d/f
./d/e
./e
./e/f
./e/e
./b
./b/f
./b/e
  • ファイル
touch {a,b,c,d,e}/{e,f}/test

結果

find .
.
./a
./a/f
./a/f/test
./a/e
./a/e/test
./c
./c/f
./c/f/test
./c/e
./c/e/test
./d
./d/f
./d/f/test
./d/e
./d/e/test
./e
./e/f
./e/f/test
./e/e
./e/e/test
./b
./b/f
./b/f/test
./b/e
./b/e/test

使い道

新しくGitのプロジェクトを作成するときなどに使えるかなと思います。
一通り想定しうるディレクトリを作成して、その下に .gitkeep を作成する、など。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1