Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

nevada

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

find

* This command finds all the files and removes them. The slash is to escape the semicolon. We don't want the semicolon to be taken as a command seperator. (it's a command delimitor for the parameter -exec).
find -name "*" -exec rm {} \;

* This command finds and removes all files and executes ls.
find -name "*" -exec rm {} \;; ls

* Find only regular files (not directories, sockets, etc).
find -type f -print

* Find patterns 'foo' in all files starting from the current directory(.).
find . -type f -exec grep foo {} \;

* List full pathnames of files in directory dirname.
find dirname

* Finds the file test.txt.
find . | grep test.txt

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS