LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 04-18-2011, 04:22 PM   #1
TheNewGuy2936
LQ Newbie
 
Registered: Apr 2011
Location: Brooklyn NYC
Distribution: Redhat & CentOS
Posts: 23

Rep: Reputation: 6
Finding Muti Files


Ok, so I work with this travel company that host sites for different agents. They have ALL the sites in one directory and each site has its own search.php file. How can I locate, and change all the search.php files permissions to 644 in one shot? Is this possible maybe with the find command? I read the man page for this but I am not sure how to write out the command. Thanks in advanced for the help everyone!
 
Old 04-18-2011, 04:35 PM   #2
jeff_sadowski
LQ Newbie
 
Registered: Sep 2007
Posts: 6

Rep: Reputation: 2
the find command will work for you in conjunction with the chmod command
cd to the directory that they all live under then run
find ./ -name search.php -exec chmod 644 {} \;
explaining this
find {directory to search} -name {name of file/files to search for} -exec {command to run} {} \;
the \; tells the -exec option that that is the end of that command
the {} is the file/files that find finds

Last edited by jeff_sadowski; 04-18-2011 at 04:39 PM.
 
1 members found this post helpful.
Old 04-18-2011, 04:36 PM   #3
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 147Reputation: 147
I'd use something like this.

Code:
find -name 'FILENAME' -exec chmod -v 644 '{}' \;
The -v option to chmod will cause it to report each file it executes on.


http://www.gnu.org/software/findutil...l#Run-Commands
 
Old 04-19-2011, 08:50 AM   #4
TheNewGuy2936
LQ Newbie
 
Registered: Apr 2011
Location: Brooklyn NYC
Distribution: Redhat & CentOS
Posts: 23

Original Poster
Rep: Reputation: 6
Thanks! Those commands did the job! Thank you for your help and explanations! I better understand the find command with those options now!
 
  


Reply

Tags
chmod, find, permissions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP with muti-boot of windows 7 and fedora 13 akmafia001 Linux - Newbie 5 09-23-2010 05:45 PM
muti sound card linux ninja master Linux - Hardware 2 02-02-2009 03:02 AM
Finding files and then finding content within those files... Maeltor Linux - Software 5 03-13-2007 12:06 PM
Stacks in Muti-threaded program arunka Linux - General 1 06-08-2006 01:20 AM
question?, X + muti monitors + multi compuers over network SciYro Linux - General 2 06-16-2005 09:26 PM


All times are GMT -5. The time now is 12:23 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration