Ask questions via twitter! Message any question to @answers on twitter. We'll publish the question and send you a reply each time there's a new answer.
Next Question

Answered Question

 
 M¢25  Funded By Mahalo ? |  June 15, 2009 09:01 PM

Is there a way to batch edit the permissions on files in Linux?

Interesting Question?  Yes (0)   No (0)   
RSS
 
 

Best Answer  Decided by Votes

 
June 20, 2009 05:48 AM | view on twitter
bash shell will allow you to use wildcards for file names passed to chmod, the command line tool you use to alter permissions.

e.g. if you want to alter the permissions on all the .php files in a directory, changing them to 754 (root:read+write+execute, group:read+execute,user:read)

chmod 754 /directory/files/are/in/*.php

Linux also allows you to chain commands together, using the | symbol, to pass on the results of one command to another, that gives you a lot of flexibility to achieve whatever you desire.

e.g. we can chain the ls (directory listing) command together with chmod:

ls /directory/files/are/in/*.php | xargs chmod 754

Yet another possibility is using the find command to files and the exec argument to tell find to do something to the files:

find /directory/files/are/in -name *.php -exec chmod 754 {} \;
Source(s):
Personal experience, over 10 years of *nix systems support.



Helpful Answer?  (0)   (0)    Tip twirrim for this answer
Permalink | Report
Voted as best: wdawe
   Reply  
 
 

Answer this Question

How tips and payments work

This question has already been resolved. You may add an answer to it but you will not be eligible to win best answer or any associated tips.

Ask a Question


140 characters left
Top of Page
Buy Mahalo Dollars with Credit Card or PayPal

Top Members

This Week All Time
  • cfinke
    cfinke
    2nd Degree Black Belt
    26536 Points
    M$29.75 Earned
  • opher
    opher
    Purple Belt with a Brown Tip
    5371 Points
    M$215.59 Earned
  • thisjustme
    thisjustme
    Green Belt
    1143 Points
    M$76.05 Earned
   See All
 

Most Popular Tags

mahalo(1733)
music(492)
iphone(479)
google(377)
food(332)
online(330)
beer(282)
money(278)
movies(275)
apple(256)
aotd(235)
health(226)
free(220)
video(219)
dog(209)
   See All
 

Categories

Welcome New Members


 
 
Mahalo Dollars are the currency of Mahalo Answers.

Each Mahalo Dollar costs $1.

Once you earn more than 40 Mahalo Dollars, you can request to be paid via PayPal. Each Mahalo Dollar is currently worth $0.75 when paid out via PayPal. Learn More

 
 

Please log in to use this function.