This is the mail archive of the
mailing list for the Cygwin project.
Re: Two short scripts for Cygwin-Windows interoperation
- From: Igor Peshansky <pechtcha at cs dot nyu dot edu>
- To: Rex Godby <rwg3 at york dot ac dot uk>
- Cc: cygwin at cygwin dot com
- Date: Thu, 4 Jan 2007 12:26:25 -0500 (EST)
- Subject: Re: Two short scripts for Cygwin-Windows interoperation
- References: <loom.20070104T172439firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
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.
|\ _,,,---,,_ email@example.com | firstname.lastname@example.org
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