Help us understand the problem. What is going on with this article?

一度に複数のファイルを特定のDirにコピー/移動(cp/mv)する ~ Unix Command ~

More than 3 years have passed since last update.

コピーコマンドは一般に、あるファイルを別のパスと名前を与えてコピーします。

$cp file1 file2

この使い方は、

cp [OPTION]... [-T] SOURCE DEST

ですが、コピーしたいファイルを引数に複数与えて、最後にコピーするDirectoryを与えることもできます。

cp [OPTION]... SOURCE... DIRECTORY

例えばこんな風にできます。

$cp a b c dir

Screen Shot 2015-01-05 at 20.14.16.png

もちろんmv も同様に、一度に移動することができます。

mv [OPTION]... [-T] SOURCE DEST
mv [OPTION]... SOURCE... DIRECTORY

Screen Shot 2015-01-05 at 20.19.25.png

結論

これがなに便利なのか!?
結果何ができるか? ワイルドカードで指定したファイルを一度に移動できます!

mv src/**/*.html dist/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした