xargsでscpを使用する方法は? [コピー]

xargsでscpを使用する方法は? [コピー]

非常に大きなファイルをあるホストから別のホストに移動しようとしています。また、ファイル名が大きすぎてxargsを使用する必要があります。また、すべてのサブディレクトリもコピーする必要があります。

ソースホスト現在のディレクトリで次のコマンドを使用します。

find . -name "*" -type f -print0 | xargs -0 scp -r UserName@host:/path/to/destination

ただし、次のエラーが発生します。

scp: /path/to/destination: not a regular file

ベストアンサー1

find . -type f -print0 | xargs -0 -I {} scp {} UserName@host:/path/to/destination

おすすめ記事