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: Accessing folders elsewhere than C:\cygwin

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. :-)


Problem reports:
Unsubscribe info:

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