Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CPIO - Absolute paths

Status
Not open for further replies.

aixTim

MIS
Jun 19, 2002
32
NL
I have an CPIO archive tape that has been created using absolute paths. I now want to recover these files to an alternate location. Is there a way of striping off the path or forcing a . onto the full path ?

 
Hi,

I use cpio to copy tree from a point to another
(instead to use cp -rd...):

cd /dir1
find . | cpio -pdm /dir2

Is not the last parameter (Directory) useful for you ?

b y e .
 
Not really - I have already got the cpio archive on tape. The problem is that it was written using absolute paths.
eg.

/usr/fred/some/thing/else/file.dat

when I read it in it goes back to /usr/fred/some/thing/else

I want to restore to cwd which would work if the file was pre-pended with a . ie ./usr/fre......

So I need to get a dot in front of it or be able to strip off the "/usr/fred/some/thing/else/"

 
Hi,

You can try this , but first BACK UP your current data

1. umount /usr/fred/some/thing/else
2. create a link of this FS else where i.e.
ln -s /usr/fred/some/thing/else /NEWDIR
3. restore cpio file cpio -ivcdumB < (cpio file/tape) or whatever flags you used.
4. then Cd into NEWDIR , back that up relatively
5. remove NEWDIR
6. mount original Filesystem
you should have original data intact.

Or the more belts and starps method

backup original data
restore cpio file
back that up relatively
restore original data

you will not be able to change the backup and put a dot in front of the filenames.

HTH
 
You can use [tt]pax[/tt] command. It can read [tt]cpio[/tt] and it can search and replace using regexes on file and path names inside archives.
I hope it works...
Unix was made by and for smart people.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top