Question

When I do ls with grep, the result is exaxtly what I need: a list of dlls, see below:

$ 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
...

But when I tried to copy all those dll to a destination say ../, I got errors and no files is copied:

$ 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
...

I used be able to to this for my previous boost build using cygwin, but I don't know why now it's not working for boost build 1-47.

Apprecaite any input.

Was it helpful?

Solution

You see a list of dlls, but you don't know in which directories they live. The directory name is printed on a separate line once, and filtered out by grep.

You cannot use ls -R for anything meaningful. The output format is too script-unfriendly. Use find instead. This command

find . -name "*.dll"

will print full path names of your dlls (no need to use grep). This command

find . -name "*.dll" -exec cp {} ..

will copy the files to .. instead of printing their names.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top