Re: chmod -R +x for directories only



Keith Matthews wrote:
billy wrote:


billy wrote:

Is it possible to change the permissions of a directory tree
(recursively) for execute on directories only?

Billy

Thanks for all the answers.

Keith I tried yours and it works great, but I think the directory may be
messed up with  Windows long file names ( it's a samba share) and I got
some errors e.g. :

chmod: cannot access `./companya/back': No such file or directory
chmod: cannot access `up': No such file or directory
chmod: cannot access `of': No such file or directory
chmod: cannot access `old': No such file or directory
chmod: cannot access `system/A.R.': No such file or directory





Indeed, find doesn't seem to cope with those very well.

Its not the find thats the problem, its the whitespace in the results returned which is then being interpreted as field separators by the shell.

a command line like

# find . -type d -exec chmod 711 {} \;

will work fine as the results of the find are passed directly to chmod without going through the shell.

The downside of the above command is that its inefficient as it invokes chmod separately for each result of the find, whereas the "chmod `find`" will only invoke both the chmod and the find once.

B.
.



Relevant Pages

  • Re: chmod hidden files
    ... If you do chmod -R 777 you mark ALL files as programs, and risk the reputation linux has as a secure OS, and you will get into problems you later blame linux for. ... a vfat partition with noexec option and an umask you prefer. ... Your shell also expand what you type on the command line, ... do as a replacement of a bad command that will give you more problems then you had before. ...
    (alt.os.linux)
  • Re: All files in TERMINAL
    ... > what the -i switch is supposed to do, ... attempt even if chmod had a clue about it since the ... wildcard is expanded by the shell, ... expanding wildcards. ...
    (comp.sys.mac.system)
  • Re: file permissions
    ... >> I'm trying to change file permissions through FTP, using chmod, but it ... If you're the sysadmin on this system, ... > Or if you aren't the sysadmin, it'll probably be easiest to do the chmod ... If you're not allowed shell on the system, ...
    (comp.unix.shell)
  • Re: chmod hidden files
    ... Sorry if I upset you, or made you confused or whatever, but chmod -R xxx ... Windows can tell if a file is a program or not by the extension ... later blame linux for. ... Sending random code to your shell may do some damage if you have bad luck. ...
    (alt.os.linux)
  • Re: File permissions
    ... Paulie wrote: ... chmod +x <filename> ...
    (alt.os.linux.suse)