Difference between revisions 507838 and 507839 on knwiki{{otheruses}} {{lowercase|title=find}} The <code>'''find'''</code> program is a [[directory (file systems)|directory]] [[Search_engine_(computing)|search utility]] on [[Unix-like]] platforms. It searches through one or more directory [[tree (computing)|trees]] of a [[filesystem]], locating [[Computer file|file]]s based on some user-specified criteria. By default, <code>find</code> returns all files below the current [[working directory]]. Further, <c(contracted; show full)e abbreviated as "o". The "and" operator is assumed where no operator is given. In many shells the parentheses must be escaped with a backslash, "\(" and "\)", to prevent them from being interpreted as special shell characters. The <code>-ls</code> option and the <code>-or</code> operator are not available on all versions of <code>find</code>. ===Execute an action=== find /var/ftp/mp3 -name "*.mp3" -type f -exec chmod 7644 {} \; This command changes the [[File system permissions|permissions]] of all files with a name ending in ''.mp3'' in the directory ''/var/ftp/mp3''. The action is carried out by specifying the option <code>-exec [[chmod]] 7644 {} \;</code> in the command. For every file whose name ends in <code>.mp3</code>, the command <code>chmod 7644 {}</code> is executed replacing <code>{}</code> with the name of the file. The semicolon (backslashed to avoid the shell interpreting it as a command separator) indicates the end of the command. Permission <code>7644</code>, usually shown as <code>rwx-r--r--</code>, gives the file owner full permission to read, write, and execu and write the file, while other users have read-only access. In some shells, the <code>{}</code> must be quoted. Note that the command itself should *not* be quoted; otherwise you get error messages like find: echo "mv ./3bfn rel071204": No such file or directory which means that '''find''' is trying to run a file called 'echo "mv ./3bfn rel071204"' and failing. (contracted; show full)[[es:Find]] [[fr:Find]] [[it:Find (Unix)]] [[hu:Find]] [[ja:Find]] [[pl:Find]] [[pt:Find]] [[ru:Find]] All content in the above text box is licensed under the Creative Commons Attribution-ShareAlike license Version 4 and was originally sourced from https://kn.wikipedia.org/w/index.php?diff=prev&oldid=507839.
![]() ![]() This site is not affiliated with or endorsed in any way by the Wikimedia Foundation or any of its affiliates. In fact, we fucking despise them.
|