home *** CD-ROM | disk | FTP | other *** search
- Here is a simple command called "cpmod" that fits in the same group as
- chmod, chown and touch.
-
- What is "cpmod"? Well, imagine these:
-
- Situation #1:
- You've got two files with different data, different modes,
- different ownerships and different times, but you realize that the
- modes, ownerships and times (or maybe just the modes and times, or
- maybe just the ownerships for example) really should be the same
- between the two files. What do you do? You could do "ls -lg file1"
- then do appropriate chmod, chown, chgrp and /usr/5bin/touch commands
- on file2, but you'd like something easier. (/usr/5bin/touch has the
- option to specify an explicit timestamp to place on the file.)
-
- Situation #2:
- You've got a directory full of dozens or hundreds of programs
- that should all have the same ownerships and modes, but you notice
- some inconsistencies. What do you do? You could do "ls -lg program"
- on one of the correct ones, then do appropriate chmod, chown and chgrp
- commands on all of the wrong ones, but that's a BIG hassle.
-
- Solution:
- Cpmod is a program which copies modes, ownerships and times from
- one existing file or directory to other existing files (or
- directories) without modifying the data in any of the destination
- files. After this program is run, an "ls -lgd" command will show
- identical information for all of the files specified on the command
- line, except for size and name. All of this is, of course, subject to
- access permissions on the files and pathnames. There are options to
- omit the modes and/or the ownerships and/or the times from the
- transfer, but if all three are omitted then there's nothing left to do
- and the program complains.
-
- Answer to Situation #1:
- cpmod file1 file2
-
- Answer to Situation #2:
- cd directory ; cpmod -t correct_file *
- Note that this will copy modes and ownerships from correct_file to all
- of the files in the whole directory, including correct_file, but that
- little redundancy is harmless.
-
- -- Steve Alter
- ...!{csun,trwrb,psivax}!ttidca!alter or alter@tti.com
- Citicorp/TTI, Santa Monica CA (213) 452-9191 x2541
-