0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Centosでファイル名に日付をつけてコピーするコマンド

Posted at

ログファイルなど、ファイルのバックアップを取るときに、
いつも手入力で```
cp -f hoge.txt hoge.txt.bak_20170922

とか、泥臭くやっていましたが、
いい加減excellentなやり方を覚えようと思い。。。

現状たどり着いたのがコレ ↓```
cp -pi hoge.txt hoge.txt.`date "+%Y%m%d_%H%M%S"`

cpコマンドの配置先ファイル名にdate関数?みたいなもの入れられるんですね…!

・・・ちゃんとLinuxコマンド勉強しますorz

0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?