Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!buddha.usc.edu!rkumar From: rkumar@buddha.usc.edu (Anon) Newsgroups: comp.unix.questions Subject: Some simple questions Message-ID: <21408@usc.edu> Date: 27 Nov 89 02:41:46 GMT Sender: news@usc.edu Reply-To: rkumar@buddha.usc.edu (C.P. Ravikumar) Distribution: usa Organization: University of Southern California, Los Angeles, CA Lines: 37 Here are some questions related to file management under UNIX. 1) dir-a and dir-b are two directories. Both may have files with same names. How does one move the latest versions of the files from dir-b to dir-a? In other words, I want foreach file f in dir-b do if (f does not exist in dir-a) then copy f from dir-b to dir-a else /* let f-a be the corresponding copy in dir-a */ if (f is more recent than f-a) move f from dir-b to dir-a endfor 2) Suppose that a text file f is being included (e.g., #include) in more than one source. What is, if there is, a mechanism to protect file f from being accidentally deleted/modified? Preferably, rm, mv, etc should be able to detect if f is being used in some other file. The user may be expected to explicitly state that f is being used in source s when s is created. Please e-mail your responses, and I will post a summary next week. Thanks, Ravi ......................................... . The Hanu-man Logo which is `'\`' (wtlifter@hanuman.edu) now selling like hot turkey :-> _/ \_