2014-01-09 11 views
9

ローカルファイルをカールでコピーする方法はありますか、それはcpコマンドの代替として機能する必要があります。ローカルファイルをカールでコピーする

これは少し奇妙ですが、私はcpが利用できない環境で作業しています。

+1

かなり確信している場合も

cd /path/to/src/dir; tar -cpf - sourcefile | (cd /path/to/dest/dir; tar -xpf -) 

tarを使用することができますrsync

rsync -avz /path/to/src/file /path/to/dst/dir 

を使用することができますしかし、私は 'curl'を避け、' cat' +基本的なシェルのリダイレクションを使用するでしょう: 'cat sourceFile> targ etFile' – Aaron

答えて

16

あなたが言うことができる:

curl -o /path/to/destination file:///path/to/source/file 

はこの /path/to/destination/path/to/source/fileをコピーします。

+0

または '' '' curl file:/// path/to/source/file>/path/to/destination'''を実行します。 –

0

あなたが後にすべての2年では気にしない、あなたのタールのサポートが-C

cd /path/to/src/dir; tar -cpf - sourcefile | tar -xpf - -C /path/to/dest/dir 
関連する問題