home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume11 / cpmod / cpmod.intro < prev    next >
Encoding:
Text File  |  1987-08-31  |  2.0 KB  |  47 lines

  1. Here is a simple command called "cpmod" that fits in the same group as
  2. chmod, chown and touch.
  3.  
  4. What is "cpmod"?  Well, imagine these:
  5.  
  6. Situation #1:
  7.      You've got two files with different data, different modes,
  8. different ownerships and different times, but you realize that the
  9. modes, ownerships and times (or maybe just the modes and times, or
  10. maybe just the ownerships for example) really should be the same
  11. between the two files.  What do you do?  You could do "ls -lg file1"
  12. then do appropriate chmod, chown, chgrp and /usr/5bin/touch commands
  13. on file2, but you'd like something easier.  (/usr/5bin/touch has the
  14. option to specify an explicit timestamp to place on the file.)
  15.  
  16. Situation #2:
  17.      You've got a directory full of dozens or hundreds of programs
  18. that should all have the same ownerships and modes, but you notice
  19. some inconsistencies.  What do you do?  You could do "ls -lg program"
  20. on one of the correct ones, then do appropriate chmod, chown and chgrp
  21. commands on all of the wrong ones, but that's a BIG hassle.
  22.  
  23. Solution:
  24.      Cpmod is a program which copies modes, ownerships and times from
  25. one existing file or directory to other existing files (or
  26. directories) without modifying the data in any of the destination
  27. files.  After this program is run, an "ls -lgd" command will show
  28. identical information for all of the files specified on the command
  29. line, except for size and name.  All of this is, of course, subject to
  30. access permissions on the files and pathnames.  There are options to
  31. omit the modes and/or the ownerships and/or the times from the
  32. transfer, but if all three are omitted then there's nothing left to do
  33. and the program complains.
  34.  
  35. Answer to Situation #1:
  36.      cpmod file1 file2
  37.  
  38. Answer to Situation #2:
  39.      cd directory ; cpmod -t correct_file *
  40. Note that this will copy modes and ownerships from correct_file to all
  41. of the files in the whole directory, including correct_file, but that
  42. little redundancy is harmless.
  43.  
  44. -- Steve Alter
  45. ...!{csun,trwrb,psivax}!ttidca!alter  or  alter@tti.com
  46. Citicorp/TTI, Santa Monica CA  (213) 452-9191 x2541
  47.