Questions tagged [symlink-traversal]

46 questions
102
votes
6 answers

Docker follow symlink outside context

Yet another Docker symlink question. I have a bunch of files that I want to copy over to all my Docker builds. My dir structure is: parent_dir - common_files - file.txt - dir1 - Dockerfile - symlink ->…
Ravi
  • 3,159
  • 6
  • 24
  • 39
34
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
  • 5,443
  • 4
  • 30
  • 45
18
votes
2 answers

Node.js: Check if file is an symbolic link when iterating over directory with 'fs'

Supervisor is a package for Node.js that monitors files in your app directory for modifications and reloads the app when a modification occurs. This script interprets symbolic links as regular files and logs out a warning. I would like to fork…
james_womack
  • 9,456
  • 6
  • 50
  • 72
11
votes
1 answer

Follow symlinks in SVN

I have a linux directory (and don't need any windows checkout): /home/me/projects/project1 In this project, I need SVN (1.8.8) to follow a symlink "link1": /home/me/projects/project1/link1/ But SVN won't let me do that,…
Cyrille
  • 11,498
  • 2
  • 14
  • 34
7
votes
1 answer

in git bash in windows ln -s /destinations/path/ link_name just copies the destination rather than creates a link

In Git bash i have run the following: ln -s "//server/path/Resource/" test When I check if it's worked: ls -l It appears as a folder rather than a symlink. I am using windows and trying to create a symbolic link to a network location. This is…
TaxiMike
  • 139
  • 1
  • 7
6
votes
1 answer

How to handle symlinks when reading data from a file path in swift

I have a file path as a string. I want to: Test if there's a file there Read the contents of the file as a string the problem I'm having is that sometimes that file path involves a symbolic link (symlink). Maybe to the file itself. Maybe to one of…
masukomi
  • 8,507
  • 8
  • 35
  • 45
5
votes
2 answers

How do you determine the path of the file that a symlink points to?

In Linux, if you have a path to a file which you know is a symlink, how do you programmatically determine (in C or C++) the path to the file that it points to?
Jonathan M Davis
  • 34,779
  • 15
  • 69
  • 99
5
votes
4 answers

How to list all members of a symlink-chain?

Finding the java binaries can be painful: which java gives /usr/bin/java lh $(which java) gives /usr/bin/java -> /etc/alternatives/java lh /etc/alternatives/java gives /etc/alternatives/java -> /usr/lib/jvm/jdk1.8.0_66/bin/java Is there a way to…
Edward
  • 3,883
  • 7
  • 32
  • 76
5
votes
1 answer

How to get diff to NOT follow symlinks?

I'm using diff to compare two huge volumes, and it is actually comparing many symlinked files over and over. Is there some way to stop this? I want it to just compare the link itself; not follow it. Or is there an alternate app that has this option?
Dan
  • 1,001
  • 2
  • 12
  • 24
4
votes
1 answer

Node.js determine path targeted by symlink

Note: using Node.js 8 I have a series of symlinks: a -> b -> c I need to resolve the initial symlink a to its target destination b. How can this be accomplished in Node.js? The fs.realpath function resolves chains of symlinks, so it resolves a to…
rich remer
  • 2,965
  • 1
  • 29
  • 39
4
votes
1 answer

How to have Git 1.6 follow "beyond symlinks"

Apparently, the bug where git follows and track files beyond symlinks (git add symlink/) has been fixed around v1.6. Now this was a bug that works in my favor. Now that we've upgraded to v1.6.3.3, is there any way to reproduce that behavior without…
keikun17
  • 121
  • 6
3
votes
1 answer

Which methods of java.nio.file.Files follow symbolic links and which don't?

The Java helper class java.nio.file.Files has methods to access file attributes. Some of the class methods follow symbolic links (all methods with a LinkOption parameter), while for some other methods it is not clear wether symbolic links are…
Julien Kronegg
  • 4,282
  • 42
  • 53
3
votes
3 answers

How can I tell if a symbolic link exists at a certain path?

I have an original file, /path/to/foo.txt, and a symbolic link to it, /other/path/to/foo.txt. I delete /path/to/foo.txt, but leave the symbolic link in-place. How can I tell that the symbolic link still exists using Cocoa APIs? I found this by…
Ben Leggiero
  • 25,904
  • 38
  • 161
  • 267
3
votes
1 answer

Firebase "symlink" to another node

In relation to my other question about modelling a real user-facing tree structure (Using firebase tree structure to represent a "document outline" structure directly), I was thinking of putting in place a generic approach to "symlinking", at…
2
votes
1 answer

perl symlink immediate target

I am looking for simple & proper way to obtain absolute path of symlink's immediate target (not final target), in perl. My Example Tree: |-- dir1 | |-- link1 -> ../dir2/link2 |-- dir2 | `-- link2 -> ../dir3/file.txt |-- dir3 | `-- file.txt `--…
Mohan
  • 105
  • 1
  • 11
1
2 3 4