[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] Quick Script Question



On Thu, 2004-01-29 at 12:40, Shawn Powers wrote:
> Dumb thing #596 for the day for me...
> 
> Is there anyway to (in a script) discriminate between files and folders?
> 
> If I need to chmod -R u+x <all the folders recursively> but don't want to make all the *files* executable, is there anyway anyone can think of do do such a thing?
> 

For individual files use test (which can be
abbreviated as [ in shell, but use 'man test'
for the options:
if [ -d path ] ; then ...  (directory)
if [ -f path ] ; then ...  (file)

But for bulk stuff you can let find build the matching
list and use xargs to process it:
find . -type d -print0 |xargs -0 chmod u+x

---
  Les Mikesell
    les futuresource com






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]