Find + Exec
Change html files to mode 644:
find /usr/local -name "*.html"-type f -exec chmod 644 {} \;
Change cgi files to mode 755:
find htdocs cgi-bin -name "*.cgi"-type f -exec chmod 755 {} \;
Run ls command on files found:
find .-name "*.pl"-exec ls -ld {} \;
Find and tar:
find .-type f -name "*.java"|xargs tar cvf myfile.tar
find .-type f -name "*.java"|xargs tar rvf myfile.tar
Find and Delete:
find .-type f -name "Foo*"-exec rm {} \;
find .-type d -name CVS -exec rm -r {} \;
Find and Copy:
find .-type f -name "*.mp3"-exec cp {} /tmp/MusicFiles \;
Last updated
Was this helpful?