Mail Archives: cygwin/2007/01/04/12:26:39
On Thu, 4 Jan 2007, Rex Godby wrote:
> Two tiny Cygwin shell scripts may be of use. Each script has a single
> active line, which I include here (to try these from the command line,
> of course replace $1 with your desired argument):
>
> 1. To quickly find files and directories in "My Documents" and Desktop
> (down to a certain depth):
>
> find "/cygdrive/c/Documents and Settings/$USER/Desktop" \
> "/cygdrive/c/Documents and Settings/$USER/My Documents" \
> -maxdepth 3 | grep "$1"
FYI, while "Documents and Settings" is the prevailing name, that directory
could have any other name (and does, in non-English versions of Windows).
The Desktop path can be obtained in a general way by "`cygpath -uD`".
Unfortunately, there is no such ready shortcut for "My Documents", though
"`cygpath -uH`/$USER/My Documents" should work for most installations of
the English versions of Windows.
Also, it's almost always faster to run 'find ... -path "*$1*"' than it is
to run 'find ... | grep "$1"'.
> 2. To open an Explorer window in a specified directory (given in Cygwin
> style), or to open a document in the proper Windows application:
>
> /cygdrive/c/WINDOWS/explorer `cygpath -w "$1"`
Or 'cygstart "$1"', where "$1" is a directory.
HTH,
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!)
|,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
Freedom is just another word for "nothing left to lose"... -- Janis Joplin
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -