Why can't I access any symbolic links that I create to what they're pointing?
Hi, this is a bit noob, but everytime I try to create softlinks to some files/dirs, I can't access them, I either get "Too many symlinks" (or something) or "No such file/dir". I'm pretty sure that I typed the addresses correctly.
I just have some songs, in my ext4 data drive, that I want to link to my ~/music dir. Note that when I create the links in that dir, and go to that dir with midnight commander, they're colored in red. (broken?) I'm using 'ln -s /path/to/file(s) /path/to/dir' What am I missing here? Thanks! |
Perhaps an example would help. Post an "ls -l" for the files and the dir before and after making the links.
From the sound of it everything should be fine, so there must be a problem with the way you're writing the actual command. |
Heh, that's strage it worked when I did:
Code:
vexe ~/temp $ ln -s /mnt/d/SNG/Intro.mp3 intro.mp3 Hmmm, but the way I was linking them, was actually in the mc command line, like this: 1- I highlight the things I wanna link. 2- I do: 'ln -s <dump the files with Ctrl+x, t> ~/music/' So...? ---------- Post added 03-11-13 at 12:38 PM ---------- Hmm... I think I shouldn't just, dump the files, cuz that way, their full path isn't specified, I think it should be their full path that I must type. |
Yes... that was it. But why? I mean, in mc, you know there are 2 panels, in the right panel, I was sitting in my songs dir, which is
'/mnt/d/SNG' and on the left, I was in '~/temp'. From the right panel, I did the linking (the way I wrote above), and in temp, I see that they are red... |
The link will be created in the destination using the exact name and path you specify. This means that the path you specify to the source must be the path when viewed from the destination. Relative paths are fine, but they must be relative from the destination dir, not from where your pwd is. See this thread for more info:
http://www.linuxquestions.org/questi...ks-4175450384/ |
I guess that's easily solved with MC's Ctrl+Shitf+Enter which gives you the full path to the selected item.
Thanks :) EDIT: Ctrl+Shift+Enter works on the current selected item, not the whole selection of items :( Does anyone know how to? |
HAHA! I just fixed my problem, wrote a script for that linking, hope somebody will find it useful:
Code:
1 #!/bin/bash |
The script can probably do with some work, but not a bad first draft. i did find the following curious:
Quote:
|
In re the above; given that that warning applies to just about every *nix cmd, you're much better off renaming files with no spaces eg use underscores instead.
|
The words destination or dest are always confusing while using it in terms of symlink creation. Instead, the simple syntax is:
Code:
~$ ln -s /path/to/file /path/to/<linkname> |
@grail: Mmm, mostly because, if anything will have spaces, it will be $file. Most of my directories doesn't have spaces.
So yes, to make it bullet-proof, surround $source and $dest with quotes as well, it's better, it won't hurt. Thanks for pointing it out :-) @chrism01: I agree, underscores saves you a lot of headaches, maybe I'll make some script, that replaces the spaces, you have in your files in some dir... |
Here's a simple script to cvt spaces to underscores (assuming ls >t.t)
Code:
IFS=$'\n' |
All times are GMT -5. The time now is 10:32 AM. |