Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!husc6!necntc!adelie!cdx39!jc From: jc@cdx39.UUCP (John Chambers) Newsgroups: comp.unix.questions Subject: uucping whole trees? Message-ID: <529@cdx39.UUCP> Date: Fri, 19-Dec-86 10:15:38 EST Article-I.D.: cdx39.529 Posted: Fri Dec 19 10:15:38 1986 Date-Received: Sat, 20-Dec-86 08:40:16 EST Organization: Codex Corp, a division of Motorola; Canton, MA, USA Lines: 54 Keywords: uucp cpio links Well, here I am again, with another "Has anyone done this yet?" question. This time the problem is: Do there exist Unix tools for copying a whole heirarchy of files intact from one system to another? Before you say "RTFM", I'll go into the obvious approaches and explain some of the gotchas in all of them. First, the trivially obvious one: find /usr -exec uucp {} somewhere!/usr/joe \; This does several things wrong. First, uucp will flatten it out into a single directory. There are ways to get around this, but then you run into the real killer: information about links is lost. You end up with multiple copies of a file, rather than multiple links to the same file. OK, so we go to cpio (or tar, if you prefer). We try: find /usr -print |cpio -o >foo.cpio uucp foo.cpio somewhere!/usr/joe/foo.cpio ... cpio -ivdum foo.cpio This has several problems. First, it requires enough free disk space to hold too.cpio, and in /usr case, that means that you'd better have half your disk free. The receiver has the same problem. Second, uucp package will almost certainly fail to transfer foo.cpio in most cases. The /usr/spool/uucp directory is very often in a separate disk partition (for good reason); uucp will try to first copy foo.c into a temp file /usr/spool/uucp/TM.12345.6789, and there won't be space. If it should perchance succeed in getting the file across, it will then try to mv it to /usr/joe/foo.cpio, and if this is in a different file system, the sender will time out and report the transfer has failed. [In this case, it might actually get there, but uucp will try it again in another hour, causing much congestion.] The obvious thing to do next is to break the list up into a bunch of lists, and send over a flock of little cpio archives. This is easier said than done. You have to somehow find out what files are multiply linked, and arrange to have them included in the same archive, or you lose the links. I'm contemplating writing some programs to do this. I figure it'll take a day or two. But I thought maybe I'd first ask around and see if anyone has already solved it. If there is a program to do it, and it takes me less than a day to get it running, I'll save some time. If I can't find a solution, I guess I'll just write my own, and maybe post it. It seems that others must have faced this problem before. The 'cptree' script works just fine on a single machine; I basically need something that will do the same across a uucp (or other file-transfer) link. -- John M Chambers Phone: 617/364-2000x7304 Email: ...{adelie,bu-cs,harvax,inmet,mcsbos,mit-eddie,mot[bos]}!cdx39!{jc,news,root,usenet,uucp} Smail: Codex Corporation; Mailstop C1-30; 20 Cabot Blvd; Mansfield MA 02048-1193 Clever-Saying: For job offers, call (617)484-6393 evenings and weekends.