[NTLUG:Discuss] how do I get a list of files that are set read-only?
Merlin
merlin at tacni.net
Fri Jan 31 08:54:57 CST 2003
Quoting Steve Baker <sjbaker1 at airmail.net>:
>
> find . -perm +o+w -print
>
> ...lists all files and directories that have "o+w" permissions.
>
> Do that on both directories - redirecting the results of
> each onto a temporary file. Then 'diff' the temporary files,
> doing a 'grep' for '<' to get the files that were o+w in the first
> directory but not the second and run the output of that to another
> temp file. Now use a text editor (or 'awk' or 'sed' if you know how)
> to replace every occurance of '<' with 'chmod -w' and run the
> output to a fourth temp file, run that as a shell script and
> you're done.
>
> Try doing *THAT* in Windoze! (I guess you go out and spend $200
> on Norton-write-protection-unscrew-up or something)
Actually, I've had to do that in Windoze before, and, as a non-sequitor, how I
did it was load the two dir listings into separate spreadsheets, write a
function in another column that compared the files flagging those I was looking
for. Then, I filterd based on that column and copy and pasted to another
spreadsheet. I then wrote a VBA module that processed the spreadsheet and
created a batch file to do what I needed to. Then all I had to do was execute
the batch file.
Tricky stuff can be done, just maybe not as easily as on Linux.
--
Merlin
"Do not meddle in the affairs of Wizards,
for they are subtle and quick to anger."
More information about the Discuss
mailing list