Basic Example: Find and chmod
bash
find . -exec chmod 777 {} \;
Use code with caution.
Understanding the Syntax Breakdown
find .: Starts the search in the current directory.- options follow
-type f: Restricts the search specifically to files, ignoring folders.-name "*.log": Matches files with a.logextension.-exec: Tellsfindto run a command on every match.chmod 777: The external command you want to run.{}: A placeholder thatfinddynamically replaces with the filename of each match.\;: Terminates the-execsequence. The backslash escapes the semicolon so your shell does not process it first.
No comments:
Post a Comment