LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Finding Muti Files (http://www.linuxquestions.org/questions/linux-newbie-8/finding-muti-files-875717/)

TheNewGuy2936 04-18-2011 05:22 PM

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!

jeff_sadowski 04-18-2011 05:35 PM

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

Telengard 04-18-2011 05:36 PM

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.

:study:
http://www.gnu.org/software/findutil...l#Run-Commands

TheNewGuy2936 04-19-2011 09:50 AM

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


All times are GMT -5. The time now is 06:35 AM.