Operating System - HP-UX
1833863 Members
1946 Online
110063 Solutions
New Discussion

How can I use cpio to download one file to another directory different from original

 
Marcelo Polizzotto
Occasional Contributor

How can I use cpio to download one file to another directory different from original

Thanks for your help !!
As you received my points, you can see that I solve part of my problem, so the new question is:

How can I use cpio the way that you told me and download the file(s) to another directory or present directory, different from original

Thanks again
Marcelo Polizzotto
Oneself is the worse enemy
7 REPLIES 7
Devbinder Singh Marway
Valued Contributor

Re: How can I use cpio to download one file to another directory different from original

As far as i am aware, since you have backed up your filesystem absolute , it will always go into /backup or unless you cd into backup and do find . -print | cpio etc..

OR , you can umount /backup , create a directory /backup and link this to the directory you want the files to be go to.

The simplest would be if possible to do a relative backup i.e. find . instead of / )

HTH
Seek and you shall find
CHRIS_ANORUO
Honored Contributor

Re: How can I use cpio to download one file to another directory different from original

cd to original directory and then:
find . -depth -print|cpio -dumpv /newdirectory
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Paula J Frazer-Campbell
Honored Contributor

Re: How can I use cpio to download one file to another directory different from original

Hi

find .|cpio -pudvm /

Will copy the files and sub dirs to your target directory.

See man cpio for the switches.

HTH

Paula
If you can spell SysAdmin then you is one - anon
Rick Garland
Honored Contributor

Re: How can I use cpio to download one file to another directory different from original

You will want to use the 'passthru' mode for cpio. That would be the p switch.

find . -depth | cpio -pmuldv /

The switches will keep the same perms and owners, create new subdirectories if needed, will prompt for overwirite, etc...

This will make a copy of the file. You will still have a copy in the original location as well.
Alan Riggs
Honored Contributor

Re: How can I use cpio to download one file to another directory different from original

If you already have the cpio archive created with absolute paths, then I suggest you investigate the pax command as a means of redirecting the extraction process.

man pax for details.
Dan Hetzel
Honored Contributor

Re: How can I use cpio to download one file to another directory different from original

Hi all,

It's funny to see that we all use the same flags for cpio, but in a different sequence. Maybe the mnemonic tricks are different due to the language difference (I'm originally french speaking)

I'm using:
cd
find . -depth | cpio -pdvum

Another solution would be to use 'tar'
cd
tar cf - . | (cd ; tar xvf -)

This was only to be a bit different ;-)

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Dan Hetzel
Honored Contributor

Re: How can I use cpio to download one file to another directory different from original

Hi,

I've just discoverd your other post and realised that you used a full pathname to archive data on your tape.
In that case, there is no way to restore your data in other location.

Dan

PS: you should have continued with your other post as it's difficult for people to know the full context when you start a new one. That leads to wrong answers and a waste of time for everybody, including you.
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com