Questions tagged [symlink]

Symlink is short for symbolic link (also soft link). It is a term for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.

symlink is short for symbolic link (also soft link). It is a term for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution

2458 questions
75
votes
9 answers

Is there a way to check if there are symbolic links pointing to a directory?

I have a folder on my server to which I had a number of symbolic links pointing. I've since created a new folder and I want to change all those symbolic links to point to the new folder. I'd considered replacing the original folder with a symlink to…
nickf
  • 537,072
  • 198
  • 649
  • 721
74
votes
4 answers

Docker and symlinks

I've got a repo set up like this: /config config.json /worker-a Dockerfile /code /worker-b Dockerfile /code However, building the images fails, because Docker can't handle the…
Chris B.
  • 85,731
  • 25
  • 98
  • 139
72
votes
16 answers

How to convert symlink to regular file?

What is the most direct way to convert a symlink into a regular file (i.e. a copy of the symlink target)? Suppose filename is a symlink to target. The obvious procedure to turn it into a copy is: cp filename filename-backup rm filename mv…
nibot
  • 14,428
  • 8
  • 54
  • 58
72
votes
5 answers

is there a way to see the actual contents of a symlink?

When you do cat some-symlink-to-some-real-file it shows the contents of the real file, not what is within the symlink itself. Is there a way to see what's actually in it?
fabio
  • 2,269
  • 5
  • 22
  • 34
68
votes
3 answers

What happens when I clone a repository with symlinks on Windows?

There's been a lot of questions about adding support for symlinks on Windows. But, what actually happens when I clone a repository with symlinks on Windows?
Andres Riofrio
  • 9,851
  • 7
  • 40
  • 60
67
votes
7 answers

Linux: Find all symlinks of a given 'original' file? (reverse 'readlink')

Consider the following command line snippet: $ cd /tmp/ $ mkdir dirA $ mkdir dirB $ echo "the contents of the 'original' file" > orig.file $ ls -la orig.file -rw-r--r-- 1 $USER $USER 36 2010-12-26 00:57 orig.file # create symlinks in dirA and dirB…
sdaau
  • 36,975
  • 46
  • 198
  • 278
61
votes
7 answers

How can I detect whether a symlink is broken in Bash?

I run find and iterate through the results with [ \( -L $F \) ] to collect certain symbolic links. I am wondering if there is an easy way to determine if the link is broken (points to a non-existent file) in this scenario. Here is my…
zoltanctoth
  • 2,788
  • 5
  • 26
  • 32
60
votes
8 answers

How do I overcome the "The symbolic link cannot be followed because its type is disabled." error when getting the target of a symbolic link?

Following on from a previous question, I am creating a symbolic link on a Server 2008 from a Vista machine using UNC paths. I can create the link just fine. I can go to the Server 2008 box and double click on the link in explorer to open the target…
David Arno
  • 42,717
  • 16
  • 86
  • 131
59
votes
5 answers

Symlink broken right after creation

I downloaded the linux Tor Browser package, which is a self-contained folder. I made a symlink to the run script: $ ln -s torbrowser/start-tor-browser ~/bin/torbrowser However, the link was broken upon creation. All I did was run that command,…
joshlf
  • 21,822
  • 11
  • 69
  • 96
59
votes
3 answers

`os.symlink` vs `ln -s`

I need to create a symlink for every item of dir1 (file or directory) inside dir2. dir2 already exists and is not a symlink. In Bash I can easily achieve this by: ln -s /home/guest/dir1/* /home/guest/dir2/ But in python using os.symlink I get an…
jurgenreza
  • 5,856
  • 2
  • 25
  • 37
58
votes
2 answers

In Bash, how do I safely determine what a soft link points to?

I need to process a number of directories, determine what files in them are symlinks, and what they link to. This sounds simple, but I have no control over the presence of control or other characters in the file names, and I need a robust…
swestrup
  • 4,079
  • 3
  • 22
  • 33
57
votes
5 answers

How to get symlink target in Python?

Using Python, I need to check whether hundreds of symlinks are correct and recreate them when not. What I do now is to compare real paths of what I want and what I have, but it's slow because it's over NFS with an automount. Otherwise I'm going to…
zorggy
  • 571
  • 1
  • 4
  • 5
56
votes
5 answers

Enable native NTFS symbolic links for Cygwin

Recent NTFS and Windows implement symlinks: NTFS junction point can be used as directory symlink since NTFS 3.0 (Windows 2000) using linkd or junction tools. NTFS symbolic link can also be used as symlink (for both file and directory) since Windows…
oHo
  • 51,447
  • 27
  • 165
  • 200
55
votes
3 answers

Does creating a symbolic link to another symbolic link have any side-effects?

Does creating a symlink to another symlink on a linux box have any side effects (specifically in terms of performance)?
5gfbtest
  • 551
  • 1
  • 4
  • 3
53
votes
8 answers

Modifying a symlink in python

How do I change a symlink to point from one file to another in Python? The os.symlink function only seems to work to create new symlinks.
meteoritepanama
  • 6,092
  • 14
  • 42
  • 55