Results 1 to 2 of 2
hello,
i want to chmod 444 all files in a directory, files in subdirs cannot be chmoded same goes for the subdirs themself.
So using:
Code:
chmod -R 444 /dir/
...
- 11-01-2008 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 10
help with chmod (files only)
hello,
i want to chmod 444 all files in a directory, files in subdirs cannot be chmoded same goes for the subdirs themself.
So using:
won't work because it will chmod the directorys and files (together with files in subdirectorys)Code:chmod -R 444 /dir/
I figured out how to chmod files only, but it still will chmod files in subdirectorys.
How can I do it?Code:find /dir/ -type f -print0 | xargs -0 chmod 444
- 11-02-2008 #2
I'm glad that you discovered the find utility. It's quite useful.
You can use the -maxdepth option to find to control this behaviour. By setting "-maxdepth 0", you tell find to only operate on the command line arguments. By setting "-maxdepth 1", you tell it to only work on entries directly in the commandline arguments. So try it with "-maxdepth 1" and see if that does it for you.DISTRO=Arch
Registered Linux User #388732


Reply With Quote