Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: Some simple questions Message-ID: <1989Nov27.114301.2440@virtech.uucp> Date: 27 Nov 89 11:43:01 GMT References: <21408@usc.edu> Distribution: usa Organization: Virtual Technologies Inc. Lines: 40 In article <21408@usc.edu>, rkumar@buddha.usc.edu (Anon) writes: > 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 Using cpio: cd dir-b find . -print | cpio -pdv dir-a > 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. The easiest way to do this (if you really want to) is to create a hard link to the file in each directory that you wish to use it. This way you can remove it from whatever directory you want to and it will still be available where ever else it was linked to. If you require this kind of operation in the same directory, then look before you remove. (of course you could link the file to different entries in the same directory and have different source files include different include files). The best solution would be to have a separate include directory wherein this file is placed and never removed (similar to /usr/include). -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+