Thanks all replying me my cpio question.
You are nice guys, Brandon, Casper, Jeffrey and one more. Sorry I miss
his name since I use ccmail and save the email body to a file and delete
the mails. I wish ccmail save the header also, but ccmail does not, shoot.
By the way, can somebody tell me how to solve this problem?
My original question is:
: I try to use cpio to copy ALL files in a directory (D1) to another
: file (F1), and retrieve them out from F1. When I do 2nd step, I only
: get files directly under D1, while files under subdirectory of
: D1 are gone.
: What I did are:
: % ls -R
: d1/ f1 f2 temp/
:
: ./d1:
: f11
:
: /temp:
: %ls -R | cpio -oc > Newfile
: % mv Newfile temp
: %cd temp
: %cpio -civt < Newfile
: drwx------ 2 litao staff 0 Sep 13 09:03 1994, d1/
: -rw------- 1 litao staff 3 Sep 13 09:02 1994, f1
: -rw------- 1 litao staff 4 Sep 13 09:02 1994, f2
: drwx------ 2 litao staff 0 Sep 13 16:04 1994, temp/
: %cpio -icv < Newfile
: %ls
: Newfile f1 f2
One of the solutions is:
1. use find instead of ls -R since cpio needs full pathname:
find . -print | cpio -oc > Newfile (ls -R | cpio -oc > Newfile)
2. add -d option so that cpio can create directories as needed:
cpio -icvd < Newfile (cpio -icv < Newfile)
By the way, I only want to use this example to see how cpio works.
If I need to copy files from one directory to another on Sun
system's, I can use "find . -depth -print | cpio -pdlmv temp" or
"cp -r . /newdirectory" as one mentioned. However,
"cp -r . temp" does not work in this case since temp is a subdirectory
of current directory and it will recursive to copy.
Email me if you have good suggestion.
Thank you very again!!
-- Litao Wu Computer Science Department Phone: (303)543-0204 Colorado State University Email: litao@cs.colostate.edu Fort Collins, CO 80523
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:09:09 CDT