1837376 Members
3309 Online
110116 Solutions
New Discussion

cpio

 
Chris Frangandonis
Regular Advisor

cpio

Hi all,

Can I cpio a file from /dev/rmt/0m and place it in the dir of my choice, if so what could the command be.


Many Thanks
Chris
8 REPLIES 8
Sandip Ghosh
Honored Contributor

Re: cpio

Yes you can.
cpio -icv
Sandip
Good Luck!!!
Helen French
Honored Contributor

Re: cpio

A. Clay Stephenson
Acclaimed Contributor

Re: cpio

Hi:

The answer is that it depends. You need to first do a cpio -icvt < /dev/rmt/0m to see if the files were backed up with absolute pathnames. If the pathnames begin with a / then restoring to another directory is difficult but if the cpio was made with relative paths the the above solution will work.

If absolute paths were used, let us know and there are ways to do that as well.
If it ain't broke, I can fix that.
Helen French
Honored Contributor

Re: cpio

Hi,

Also, change the directory first and then restore the files:

# cd /home
# cpio -idumv < /dev/rmt/0m

This may help you:

http://us-support2.external.hp.com/cki/bin/doc.pl/sid=4de0f0f71bb831ea7a/screen=ckiDisplayDocument?docId=200000048117871

HTH,
Shiju
Life is a promise, fulfill it!
H.Merijn Brand (procura
Honored Contributor

Re: cpio

If you use the GNU version of cpio (I've still made it temporary available on http://home.hccnet.nl/h.m.brand/ncpio) you can use the option --no-absolute-filenames to achieve what you want.

--no-absolute-filenames
In copy-in mode, create all files relative to the current
directory, even if they have an absolute file name in the
archive.


# cd /tmp/temp
# ncpio -iuvdm --no-absolute-filenames
Job done :)
Enjoy, Have FUN! H.Merijn
Frank Slootweg
Honored Contributor

Re: cpio

If it is one or a few files and you can do it interactively, then you can do it by (also) specifying the "r" (rename) option:

$ ll /tmp/passwd
/tmp/passwd not found
$ echo '/etc/passwd' | cpio -o >junk.cpio
29 blocks
$ cpio -ir '/etc/passwd' Rename
/tmp/passwd
29 blocks
$ ll /tmp/passwd
-r--r--r-- 1 franks ftp_group 14319 Mar 15 14:38 /tmp/passwd
$

If it is for many files or/and non-interactively, then see pax(1). pax(1) can read (and write) cpio (and tar) archives.
Chris Frangandonis
Regular Advisor

Re: cpio

Hi all,

Thanks a lot for all your help, much appreciated.
Sorry about the delay, my PC got struck by lightning and took time to fix.

Thanks once again
Chris
Jeff Schussele
Honored Contributor

Re: cpio

Maybe that was God telling you to use a UNIX W/S ;^)

tongue firmly in cheek,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!