English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Does anyone know how to write a shell script that would disable writing and executing rights for my group on all *.txt files?

2007-04-19 05:11:16 · 3 answers · asked by Vanderbere 2 in Computers & Internet Programming & Design

3 answers

for ea in `find / -name *.txt`; do chmod 744 $ea;done

this will do ALL files on the system

Heya this command will find ALL files that end in .txt and chmod them to 744.. which is owner all privileges.. group read only... world read only..

If you want to specific location do

for ea in `find /your/location -name *.txt`; do chmod 744 $ea;done



This should do the trick! please pay attention to the ` they are not ' .. just copy and paste it and modify the location..



Hope it helps!



Blue Chip Hosting staff,
http://www.bluechiphosting.com

2007-04-19 05:32:05 · answer #1 · answered by Anonymous · 0 0

My *nix is a bit rusty, but it should be a SINGLE chmod command, no script needed.

2007-04-19 12:22:33 · answer #2 · answered by Kasey C 7 · 0 0

all you'd have to do is something along the lines of:

chmod 444 *.txt

this will change "yours", "your group's" and, "others' " permissions to read only.

2007-04-19 16:18:48 · answer #3 · answered by Entfusion 3 · 0 0

fedest.com, questions and answers