delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/02/09/10:50:58

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_YG
X-Spam-Check-By: sourceware.org
Message-ID: <4D52B7D5.5020200@bopp.net>
Date: Wed, 09 Feb 2011 09:50:45 -0600
From: Jeremy Bopp <jeremy AT bopp DOT net>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Accessing folders elsewhere than C:\cygwin
References: <4D52A7DD DOT 7080208 AT bonhard DOT uklinux DOT net>
In-Reply-To: <4D52A7DD.7080208@bonhard.uklinux.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 02/09/2011 08:42 AM, Fergus wrote:
> I have Cygwin mounted conventionally under Q:\cygwin.
> I would like to access files under Q:\else.
> But (for example) ls ../../.. only ever attains \cygwin (and lower).
> I can use ls /cygdrive/q/else/ (and lower) but this means knowing the
> drive name (in this case Q:)
> I don't much want to change mount points which are currently
> conventionally defined.
> Is there a way I can get to Q:\else without knowing the drive name Q:?

If creating a new mount in addition to your standard mounts is out of
the question (not sure if that's what you meant), you could add
something like the following to your .bashrc or .bash_profile file:

function else_path {
  cygpath -u $(cygpath -m /)/../else
}

Then you could refer to the path as follows:

ls $(else_path)
cd $(else_path)

Another option would be to create a temporary mount within one of your
startup files:

mount | grep -q 'on /mnt/else type' ||
  mount $(cygpath -m)/../else /mnt/else

Now you can access Q:\else as /mnt/else.  If you decide you would like
to make a more permanent mount but just for your user, you can read in
the Cygwin Users Guide for how to set that up in a file under
/etc/fstab.d/.  Of course, you can also make the mount available to all
users by adding it to /etc/fstab. :-)

-Jeremy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019