CPIO archives

Lynn David Newton lynn.newton at gmail.com
Thu Jul 5 12:01:17 MST 2007


  n> <dunce cap on>

  n> I have a cpio archive that I am trying to extract. I would like to dump the 
  n> entire archive, change some files then re-create the archive. But everytime I 
  n> try to extract the archive it over-writes files in my / directory tree... 
  n> very bad!

  n> cpio -i < archive.cpio

  n> How do I extract it and force it to a specific tree?

If it's doing that it probably means the archive was
created using an absolute pathname, i.e., with "/" at
the beginning. 

  cpio -itv < archive.cpio

will show you the paths. If they start with "/" you may
be out of luck unless you can find a way to do it in a
chroot environment. I'm unwilling to experiment with
that myself right now, but maybe someone else has a
better idea.

Man, I had to blow the dust off my cpio man page on
that one. I used to run it a hundred times a day, but
for years I've run it only in passthrough mode (-p) to
copy directories, not to create archives, since these
days tar seems to be the preferred command for creating
single file archives.

-- 
Lynn David Newton
Phoenix, AZ



More information about the PLUG-discuss mailing list