CPエラー(LSとGREPとの使用の組み合わせ)-CP:統計できません
質問
Grepを使用してLSを行うと、結果は私が必要なものにします。DLLのリスト、以下を参照してください。
$ ls -R | grep "dll$"
boost_chrono-vc90-gd-1_47.dll
boost_chrono-vc90-mt-gd-1_47.dll
boost_chrono-vc90-1_47.dll
boost_chrono-vc90-mt-1_47.dll
boost_date_time-vc90-gd-1_47.dll
boost_date_time-vc90-mt-gd-1_47.dll
boost_date_time-vc90-1_47.dll
boost_date_time-vc90-mt-1_47.dll
boost_filesystem-vc90-gd-1_47.dll
boost_filesystem-vc90-mt-gd-1_47.dll
boost_filesystem-vc90-1_47.dll
...
しかし、これらすべてのdllを目的地にコピーしようとしたとき、私はエラーがあり、ファイルはコピーされません。
$ cp `ls -R | grep "dll$"` ../
cp: cannot stat `boost_chrono-vc90-gd-1_47.dll': No such file or directory
cp: cannot stat `boost_chrono-vc90-mt-gd-1_47.dll': No such file or directory
cp: cannot stat `boost_chrono-vc90-1_47.dll': No such file or directory
cp: cannot stat `boost_chrono-vc90-mt-1_47.dll': No such file or directory
cp: cannot stat `boost_date_time-vc90-gd-1_47.dll': No such file or directory
cp: cannot stat `boost_date_time-vc90-mt-gd-1_47.dll': No such file or directory
cp: cannot stat `boost_date_time-vc90-1_47.dll': No such file or directory
cp: cannot stat `boost_date_time-vc90-mt-1_47.dll': No such file or directory
cp: cannot stat `boost_filesystem-vc90-gd-1_47.dll': No such file or directory
cp: cannot stat `boost_filesystem-vc90-mt-gd-1_47.dll': No such file or directory
...
Cygwinを使用して以前のBoost Buildにこれを使用できましたが、Boost Build 1-47に機能していない理由はわかりません。
あらゆる入力に感謝します。
解決
DLLのリストが表示されますが、どのディレクトリが住んでいるのかわかりません。ディレクトリ名は1回別の行に印刷され、で除外されます grep
.
使用できません ls -R
意味のあるもののために。出力形式は、スクリプトにフレンドリーではありません。使用する find
代わりは。このコマンド
find . -name "*.dll"
DLLのフルパス名を印刷します(使用する必要はありません grep
)。このコマンド
find . -name "*.dll" -exec cp {} ..
ファイルをにコピーします ..
名前を印刷する代わりに。
所属していません StackOverflow