symlink

How to resolve symbolic links in a shell script

Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username notation at the same time. If the target is a directory, it might be possible to chdir() into the directory and then call getcwd(), but I r...

Cannot delete, a file with that name may already exist.

This is starting to vex me. I recently decided to clear out my FTP, and stumbled across an old Wordpress install I forgot I had (oh yes, very security conscious me). Anyway, for some reason deleting the directory failed so I investigated to see what was causing the blockage and I've narrowed it down to a file in wp-content. Now when I t...

How to create symbolic links in Windows?

Related In .NET, how do I Create a Junction in NTFS, as opposed to a Symlink? I've tried Winbolic (Windows XP), but I can't get it to work the way I want. Am I wrong here? If I create a symbolic link within a folder in my %PATH%, the referenced directory should work as if it had actually been added to %PATH%, right? ...

How can I get git to follow symlinks?

I've had a google for how to do this, but not had any luck. Is my best be going to be a shell script which replaces symlinks with copies, or is there another way of telling git to follow symlinks? PS: I know it's not very secure, but I only want to do it in a few specific cases. ...

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 the new folder, but it seems that if I continued with that practice it could get very mes...

How to get/set logical directory path in python.

In python is it possible to get or set a logical directory (as opposed to an absolute one). For example if I have: /real/path/to/dir and I have /linked/path/to/dir linked to the same directory. using os.getcwd and os.chdir will always use the absolute path >>> import os >>> os.chdir('/linked/path/to/dir') >>> print os.getcwd() /...

How do you get what a symbolic link points to without grep?

Say you have a symbolic link, i.e., a -> b. In *nix, is there a command that will simply output what 'a' points to (i.e., 'b') but with nothing else? Typically we do a ls -l and pipe it to grep or something, but say I don't want to do any parsing. Is there a way to do this? ...

What is the difference between a symbolic link and a hard link?

Recently I was asked this during a job interview. I was honest and said I knew how a symbolic link behaves and how to create one, but do not understand the use of a hard link and how it differs from a symbolic one. ...

How do I create a symlink in Windows Vista?

I am looking to create symlinks (soft links) from Java on a Windows Vista/ 2008 machine. I'm happy with the idea that I need to call out to the JNI to do this. I am after help on the actual C code though. What is the appropriate system call to create the link? Pointers to some good documentation on this subject would be very much appreci...

Remove a symlink to a directory

I have a symlink to an important directory. I want top get rid of that symlink, while keeping the directory behind it. I tried 'rm' and get back "rm: cannot remove 'foo'". I tried 'rmdir' and got back "rmdir: failed to remove 'foo': Directory not empty" I then progressed through 'rm -f', 'rm -rf' and 'sudo rm -rf' Then I went to find...

How do I programmatically access the target path of a windows symbolic link?

Windows 6 (Vista and Server 2008) support proper symbolic links, which can be created via the CreateSymbolicLink function. But there doesn't appear to be a corresponding function for interrogating a symbolic link to obtain the path of the link's target. I have found out that symbolic links are an implementation of reparse points, and so...

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 on Server 2008?

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 file. What I cannot do though is use FileCreateW to get a handle to the UNC path link (fro...

java - determining if a file is a link

Title says it all. How do you do it, or is it even possible? I suppose you could fiddle with getCanonicalWhatever and the original path, but that's messy and I don't like it. Please include a definitive reason if you suggest it. ...

Configure Symlinks for single directory in Tomcat

Hi, I have a directory to which a process uploads some pdf files. This process is out of my control. I need to make those files available through the website using Tomcat. I have a directory available to the web, with the browser I can see files in it : /var/lib/tomcat5/webapps/test1 So I created a symbolic link to point at the direc...

Tomcat context.xml files, is there a hiearchy?

I am trying to use symbolic links in one of the applications I have running on Tomcat5. Thanks to some help from another StackOverflow question I was able to do it by creating a context.xml file in /...myapplication/META-INF/context.xml I am now trying to implement this on a production server. However, there are other applications ...

Can this build system be sped up?

Our build is dog slow. It uses nested gnu makefiles on linux. It creates three builds for three different targets from the same source tree. It uses symlinks to point to each of the three parallel directory trees in turn. We can do partial builds by using make inside subdirectories, which saves time, but if our work spans multiple direct...

Finding relative libraries when using symlinks to ruby executables

Imagine you have an executable foo.rb, with libraries bar.rb layed out in the following manner: <root>/bin/foo.rb <root>/lib/bar.rb In the header of foo.rb you place the following require to bring in functionality in bar.rb: require File.dirname(__FILE__)+"../lib/bar.rb" This works fine so long as all calls to foo.rb are direct. I...

reformatting windows lnk file via automated script

Problem: There are a bunch of .lnk files on C drive that point to the J: drive, but the J: drive is gone the P: drive has replaced it. Various tricks have been done to get the .lnk files to still work anyway, but it's getting annoying and it's time to just fix the things. Question: Using Ruby, Python, WSH.JScript or Perl, can you iterat...

Can I traverse symlinked directories in Ruby with a "**" glob?

In Ruby, Dir.glob("**/*.rb") (for instance) doesn't traverse symlinked directories. Is it possible to get the ** to traverse symlinks? I'm using two gems which find files this way, but I need them to see files within a symlinked directory. ...

How do I copy symbolic links in Perl?

Hi all, How do I copy a symbolic link (and not the file it points to) in a Perl program while preserving all of the symbolic link attributes (such as owner and permissions)? Thanks, splintor ...