Operating System - HP-UX
1834930 Members
2567 Online
110071 Solutions
New Discussion

newbie - CPIO restore problems

 
Jennie Gutentag
Occasional Contributor

newbie - CPIO restore problems


Hi All !

I have a problem with cpio restore options.
I want to be able to restore data to a temporary directory and not to its original location.
any attempts I did using -p options have failed ....
any ideas ? .......

any help will be highly appreciated !
Thanx,
Jennie

5 REPLIES 5
Jean-Louis Phelix
Honored Contributor

Re: newbie - CPIO restore problems

Hi,

In your case, the easiest tool wouldn't be cpio, but rather 'pax' which is used by ignite UX and can read tar as well as cpio archives. Th most important feature is the 's repl_string' which allows you to subsiture patterns in restore paths. I use it especially for archives created with absolute paths. You can even find examples in the man page.

Best regards,

Jean-Louis.
It works for me (© Bill McNAMARA ...)
john korterman
Honored Contributor

Re: newbie - CPIO restore problems

Hi,
I have just tried this:

# pax -rv -s'/^\///' < your_cpio_archive

and it extracts everything from your_cpio_archive and writes it to your current directory. I is perhaps also possible to use pax with the -i option for interactive mode.

regards,
John K
it would be nice if you always got a second chance
Graham Cameron_1
Honored Contributor

Re: newbie - CPIO restore problems

Or if your archive only contains a few files and you want to stick with cpio, use the '-r' option to rename files as they are copied in.

This is unworkable for large archives, unless you like typing...

-- Graham
Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.
Keith Bevan_1
Trusted Contributor

Re: newbie - CPIO restore problems

Jennie,

One quick question/suggestion.

Is the path on the tape an absolute path or relative.

If the path begins with / then its absolute and will cause you some issues.

If the path begins with a directory or filename eg tmp/ or data/ etcetera then you can cd to where you want the files restored and run the cpio command without problems.

Keith
You are either part of the solution or part of the problem
Rory R Hammond
Trusted Contributor

Re: newbie - CPIO restore problems

mkdir /tmpdir
cd /tmpdir
cpio -idmu < /location/cpio.file

the p would be used if the directory already exists. Let say after you restored it to a tmp dir and you want to put in another directory
cd /tmpdir
find . -print |cpio -pdmu /another_directry

good luck
Rory

There are a 100 ways to do things and 97 of them are right