Friday, April 12, 2013
Wrapper script for find
I find (hah) myself using
find a lot to locate file system objects in the current directory, however find recurses into subdirectories by default. Using the parameters
-mindepth 1 -maxdepth 1 restrict find to the current directory, are however a pain to type each time.
To make my own personal life easier I created this wrapper script (named
#!/bin/sh if [ ($# < 1) ]; then FINDPATH=. else FINDPATH=$1 shift fi find $FINDPATH -mindepth 1 -maxdepth 1 $@
which automatically prepends the
find (they need to be first in the argument list).
Posted at 5:34 PM |Comments (0)