home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / unix / question / 13731 < prev    next >
Encoding:
Internet Message Format  |  1992-11-21  |  1.9 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!drycas.club.cc.cmu.edu!pitt.edu!suthers
  2. Newsgroups: comp.unix.questions
  3. Subject: Re: Utility for keeping two directories consistent (identical)?
  4. Message-ID: <10015@blue.cis.pitt.edu.UUCP>
  5. From: suthers+@pitt.edu (Daniel D Suthers)
  6. Date: 21 Nov 92 17:12:00 GMT
  7. Sender: news+@pitt.edu
  8. Followup-To: suthers+@pitt.edu
  9. References: <9966@blue.cis.pitt.edu.UUCP>
  10. Organization: University of Pittsburgh
  11. Keywords: directory consistency
  12. Summary: find . -print |cpio -pmd other_directory
  13. Lines: 38
  14.  
  15. In article <9966@blue.cis.pitt.edu.UUCP> I wrote:
  16. >Do you know of a utility for keeping the contents of two directories
  17. >consistent (identical)? 
  18.  
  19. Thanks much to les@chinet.chi.il.us (Leslie Mikesell) for this, which
  20. works nicely.
  21.  
  22. > How about going to one directory and doing a:
  23. >   find . -print |cpio -pmd other_directory
  24. > and then reversing the process.  If you don't include the -u flag
  25. > cpio should not overwrite any files that are newer or the same age
  26. > and the -m option will keep the timestamp correct on copied files.
  27.  
  28. I use -pmdv to see what's going on. Too bad -i isn't "interactive"
  29. like in rm but I should know better than to expect consistency from Unix!
  30.  
  31. The man pages for cpio actually address this (almost) but all the apropos
  32. I could think of couldn't find it. Should know better than to expect
  33. usability from Unix!
  34.  
  35. >    This example shows how to copy the contents of the user's current direc-
  36. >     tory into an archive.
  37. >
  38. >     ls | cpio -o  > /dev/rmt0l
  39. >
  40. >     This example shows how to duplicate a directory hierarchy.
  41. >
  42. >     mkdir ~phares/newdir
  43. >     cd ~phares/olddir
  44. >     find . -print | cpio -pdl ~phares/newdir
  45.  
  46. (Uh oh, I badmouthed someone's religion, now I'm really in trouble ...)
  47.  
  48. -- 
  49. ..........................................................................
  50.  Dan Suthers            | LRDC, room 505A
  51.  suthers+@pitt.edu      | 3939 O'Hara Street
  52.  (412) 624-7036 office  | University of Pittsburgh
  53.