Wednesday, February 3, 2010

Using the locate command with --regex (or --regexp)

locate is much faster than find...

# Find images in my homedir and its descendants (children, thier children etc.)
locate --regex \/home\/kees\/.*\(.png\|.jpg\|.gif\)
# Find images only in direct children of my homedir
locate --regex \/home\/kees\/[^\/]*\/[^\/]*\(.png\|.jpg\|.gif\)

No comments: