"John P. Looney" wrote:
>> On Fri, Apr 06, 2001 at 02:00:20PM +0100, Paul Askins mentioned:
> > Does anybody know of a way to copy all files recursively from one directory to
> > another without re-creating the original dir structure. I'm sure tar can
> > prolly do this but can't figure out how, everything I try just keeps
> > re-creating the original dir structure.
> > Any help appreciated,
>> Find is your friend;
>> find /dir -name -type f \* -exec cp -a {} /target/dir \;
>> That'll copy every file in /dir into /target/dir, preserving
> attributes...
Tar is also usable -
cd /dir && tar cfz - . | (cd /target/dir && tar xvfz -)
Why the empty -name flag to find? Why not just leave it out?
I'm assuming that by "Not get the original structure" you mean that you
don't want to copy /dir to /new_dir and get /new_dir/dir? If you don't
want *any* directory structure, Kate's method works.
> Kate
Cheers,
Dave.
--
David Neary, E-Mail dave.neary at palamon.ie
Palamon Technologies Ltd. Phone +353-1-634-5059
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!