Date: Sun, 11 Aug 1996 14:22:42 -0700 From: patl@asimov.volant.org To: chuckr@glue.umd.edu Cc: FreeBSD-Ports@freebsd.org Subject: Re: using tar Message-ID: <9608112122.AA01482@asimov.volant.org>
next in thread | raw e-mail | index | archive | help
|> > |> cd <source_dir> |> > |> tar cf - | ( cd <dest_dir>; tar xvfBp - ) |> > |> > An arguably better way to copy an entire directory tree within a single |> > machine is: |> > |> > cd <source_dir> |> > find . -depth -print | cpio -pdmv <dest_dir> |> |> You aren't the first person to point that method out (Joerg told me about |> it too) but I hadn't had any argument about it being 'arguably better'. |> Could/would you expand on that? Hmm. It's been a couple of years since I switched over; and I no longer recall all of the reasons. I believe the most convincing ones involved the treatment of sparse filenames and very long pathnames, empty directories, device files, etc. (Most people don't realize that the traditional tar format has a filename length limit. According to the Solaris man page, the total length is 255 characters, with no more than 155 for the path and 100 for the filename. The FreeBSD man page doesn't mention limits; but FreeBSD uses GNU tar, which can use extended file formats.) Using a GNU tar pipe with appropriate options might work as well as the find|cpio pipe; but it would be a much more cumbersome command. Also, every byte of every file is read and written twice in the tar|tar pipe. (Each tar has both diskfile and pipe I/O.) In the find|cpio pipe only directories are actually read by the find; and only the filenames are passed through the pipe. That means fewer I/O operations and fewer context switches; for better performance. -Pat My opinions are my own. For a small royalty, they can be yours as well... Pat Lashley, Senior Software Engineer, Henry Davis Consulting patl@Phoenix.Volant.ORG http://Phoenix.Volant.ORG/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9608112122.AA01482>