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
53
votes
3 answers

How do I get the target of a symlink?

I have a string containing the file system path to an existing symlink. I want to get the path that this link points to. Basically I want the same that I'd get through this bit of hackery: s = "path/to/existing/symlink" `ls -ld #{s}`.scan(/->…
kch
  • 77,385
  • 46
  • 136
  • 148
47
votes
9 answers

Find out whether a file is a symbolic link in PowerShell

I am having a PowerShell script which is walking a directory tree, and sometimes I have auxiliary files hardlinked there which should not be processed. Is there an easy way of finding out whether a file (that is, System.IO.FileInfo) is a hard link…
Joey
  • 344,408
  • 85
  • 689
  • 683
47
votes
2 answers

How can I derefence symbolic links in bash?

How can I take any given path in bash and convert it to it's canonical form, dereferencing any symbolic links that may be contained within the path? For example: ~$ mkdir /tmp/symtest ~$ cd /tmp/symtest/ /tmp/symtest$ mkdir -p foo/bar…
David Dean
  • 7,435
  • 6
  • 33
  • 41
45
votes
9 answers

Check if a file is real or a symbolic link

Is there a way to tell using C# if a file is real or a symbolic link? I've dug through the MSDN W32 docs, and can't find anything for checking this. I'm using CreateSymbolicLink from here, and it's working fine.
mattdwen
  • 5,288
  • 10
  • 47
  • 61
44
votes
8 answers

replace all symlinks with original

I have the following directory structure /symdir sym1 -> ../dir1 sym2 -> ../dir2 hello.txt And then /dir1 some files here /dir2 more files I would like to replace the symlinks in symdir (sym1, sym2) with the originals. …
Ken Hirakawa
  • 7,831
  • 10
  • 38
  • 49
44
votes
11 answers

Symlinks on windows?

Does anyone know of a way to make/read symbolic links across versions of win32 from Python? Ideally there should be a minimum amount of platform specific code, as I need my app to be cross platform.
Harkonnen Jama
44
votes
3 answers

Nginx not following symlinks

I have installed nginx on Ubuntu 12.04. However, nginx does not seem to follow symlinks. I understand that there is a config change required for this but I am not able to find where to make the change. Any help appreciated.
Neo
  • 3,465
  • 5
  • 26
  • 37
43
votes
8 answers

How do you get PHP, Symlinks and __FILE__ to work together nicely?

On localhost. I have the following directory structure: /share/www/trunk/wp-content/plugins/otherfolders /share/www/portfolio/wp-content/symlink Where symlink is a symbolic link to /trunk/.../plugins/. Basically, this is because I need to test…
Aaron Butacov
  • 32,415
  • 8
  • 47
  • 61
41
votes
3 answers

Cannot overwrite Symbolic Link RedHat Linux

I have created a symbolic link: sudo ln -s /some/dir new_dir Now I want to overwrite the symbolic link to point to a new location and it will not overwrite. I have tried: sudo ln -f -s /other/dir new_dir I can always sudo rm new_dir, but I would…
Chuck Burgess
  • 11,600
  • 5
  • 41
  • 74
41
votes
3 answers

Bash: how to get real path of a symlink?

Is it possible, executing a file symlinked in /usr/local/bin folder, to get the absolute path of original script? Well, .. I know where original file is, and I know it because I am linkging it. But, ... I want this script working, even if I move…
sensorario
  • 20,262
  • 30
  • 97
  • 159
40
votes
4 answers

git commit symlink as a regular file

Suppose I have a file fname which is a symlink to a file from some other repository/project, say ../../proj2/fname. Is there a way to add/commit fname as a regular file? It seems that, by default, git gives the file mode 120000 and sets the path to…
hasen
  • 161,647
  • 65
  • 194
  • 231
40
votes
8 answers

powershell to resolve junction target path

In PowerShell, I need resolve the target path of a junction (symlink). for example, say I have a junction c:\someJunction whose target is c:\temp\target I tried variations of $junc = Get-Item c:\someJunction, but was only able to get…
ash
  • 3,354
  • 5
  • 26
  • 33
39
votes
3 answers

Can I symlink multiple directories into one?

I have a feeling that I already know the answer to this one, but I thought I'd check. I have a number of different folders: images_a/ images_b/ images_c/ Can I create some sort of symlink such that this new directory has the contents of all those…
nickf
  • 537,072
  • 198
  • 649
  • 721
39
votes
1 answer

Python os.walk + follow symlinks

How do I get this piece to follow symlinks in python 2.6? def load_recursive(self, path): for subdir, dirs, files in os.walk(path): for file in files: if file.endswith('.xml'): file_path = os.path.join(subdir,…
fmalina
  • 6,120
  • 4
  • 37
  • 47
39
votes
6 answers

How to use submodules publicly, but symlinks to a single clone locally?

I'm having my first Git Submodule experience. I have some projects that depend on the same subproject. I keep these projects in sync, so I'm using the "submodule branch" feature (e.g. git submodule add -b master [URL]). While I'd like the public…