Saturday, March 12, 2011

grep files from results by find

 find /var/ftp/mp3 -name "*.mp3" -type f -exec chmod 644 {} \;
 This command changes the 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 -exec chmod 644 {} \; in the command. For every file whose name ends in .mp3, the command chmod 644 {} is executed replacing {} 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 644, usually shown as rw-r--r--, gives the file owner full permission to read and write the file, while other users have read-only access. In some shells, the {} must be quoted.
 copied from http://en.wikipedia.org/wiki/Find

No comments: