This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Two short scripts for Cygwin-Windows interoperation


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@cs.nyu.edu | igor@watson.ibm.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]