Help with copy files from multiple directories one inside other of the same type to one directory

Alexander Skwar listen at alexander.skwar.name
Sat Jul 29 14:06:09 UTC 2006


· Jhair Tocancipa Triana <jhair.tocancipa at gmail.com>:

> find main -name \*.deb -print | xargs -i cp \{\} ~/filesdeb

This might fail, as soon as there are special characters in the
file/directory names (like \n (line feed)). For this reason, it's
much better to use "-print0" for find and "--null" for xargs, like
so:

find main -name \*.deb -print0 | xargs -0i cp \{\} ~/filesdeb

Also, it's not necessary to escape the { and }, thus the following
is better and easier:

find main -name \*.deb -print0 | xargs -0i cp {} ~/filesdeb

Alexander Skwar
-- 
Das ändert nichts dran, daß ich eine Menge mehr über
Oldenburg aus dem Stachel, als aus der NWZ erfahre.
                -- Terra






More information about the ubuntu-users mailing list