[ale] Baffled on chmod usage

Byron A Jeff byron at cc.gatech.edu
Thu Aug 10 16:23:29 EDT 2000


> 
> I want to chmod all the .exe files within and below the directory "public,"
> so I go:
> 
> 	# cd /<path>/public
> 	# chmod -Rv 555 *.exe
> 
> but I get
> 
> 	chmod: *.exe: No such file or directory
> 
> FWIW, there are no .exe files in public, but there are many of them
> scattered in directories underneath public.  What I especially don't
> understand is that if I go 
> 
> 	# chmod -Rv 555 *
> 
> then everything and its brother in public and below gets chmodded.  I can
> use some other extension besides .exe that I know is present but I still get
> No such file or directory.
> 
> Am I misusing wildcards in bash or something?

Yes. The wildcard only selects files in the current directory, not all the
subdirectories. 

This is an instance where the recursive option of chmod and bash's wildcards
do not work together. 

find and xargs gives a fairly useful combination:

find . -name '*.exe' | xargs chmod -v 555

The find will generate names for each of the files with an exe extension.
The xargs will then execute the chmod command against every file found.

BAJ
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.





More information about the Ale mailing list