How can I chmod/chown a specific list of files?
Almost all Unix tools accept a list of files as non-option arguments. As usual, the different arguments have to be separated by space:
chmod 644 one two three
In your second example, if you're using Bash, a simple
chmod -R 644 !(cache)
will be enough.
This approach requires extended pattern matching. If it's disabled, you can enable it with
shopt -s extglob
See: Bash Reference Manual # Pattern Matching
Make a list of filenames in ./list-of-filenames-to-change.txt
and then run:
chmod g+w `cat list-of-filenames-to-change.txt`
or use the method described by others here:
chmod 644 one two three
or go to town with the first option but manipulate each line in the file (in this example: replace " /" (WITH whitespace before) by " ./"):
chmod g+w `sed 's/ \// .\//' update-writable.txt`
If the files you want to modify are in one directory you can ls them with the needed pattern.
e.g. I need all downloaded .run files in pwd to be changed to executable:
chmod +x `ls *.run`