Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This one is probably easy for all of you, but I have never had to deal with such a nested local set of directories.

If I have a path like: /mnt/media2/Archived\ Files/_Transfer/ is there a way to "mount" that directory to ~/Transfer/ or /mnt/transfer?

I was looking into symlinks, but it talks about "how it's not always a good idea on directories because of recursive commands, etc..."

Thanks.

share|improve this question
1  
This is what symlinks are for. Just try not to set up circular links, because that won't be useful to anyone, and you should be fine. –  jw013 Sep 21 '12 at 14:43

2 Answers 2

up vote 6 down vote accepted

Symlinks do sound a good idea to me in this case:

ln -s /mnt/media2/Archived\ Files/_Transfer/ ~/Transfer

See also zsh's:

PS1='%~%# '
transfer=/mnt/media2/Archived\ Files/_Transfer/
cd ~transfer
share|improve this answer
    
For the section about zsh's above -- can I copy using that format too? I.e. cp ~/test.sh ~transfer/.? And do I still retain rw privileges in the linked directory? –  chow Sep 21 '12 at 16:30
1  
@chow They're called named directories. They work in all cases where the shell interprets the string, which includes passing arguments to commands –  Michael Mrozek Sep 21 '12 at 17:26
    
Awesome -- works great. –  chow Sep 22 '12 at 6:52

If you don't want to (or can't) use symlinks (e.g., filesystem doesn't support, like vfat), you can also use a bind mount:

mount --bind "/mnt/media2/Archived Files/_Transfer" /mnt/Transfer

Beware that bind mounts are stronger than symlinks. E.g., rm -Rf will just remove a symlink when it encounters one; it'll traverse through a bind mount.

Bind mounts can only be done by root. Symlinks can be done by any user.

share|improve this answer
1  
I do not recommend bind mounts for this. The directory tree will effectively appear twice for many purposes (backups, indexing, etc. — anything that traverses the directory tree). Symlinks are the right answer here. –  Gilles Sep 21 '12 at 23:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.