symlink

How do you determine using stat() whether a file is a symbolic link?

I basically have to write a clone of the UNIX ls command for a class, and I've got almost everything working. One thing I can't seem to figure out how to do is check whether a file is a symbolic link or not. From the man page for stat(), I see that there is a mode_t value defined, S_IFLNK. This is how I'm trying to check whether a file ...

Migrating from CVS to Mercurial - how to handle cross-repo symbolic links?

I have a project that is stored in CVS as numerous modules/repositories. In several of the modules the CVS tree has symbolic links to the files in another tree. For example, the internal support tools have links to binary files (DLL, EXE) that are created and stored in the C# module. In all cases, the files are modified only in in the...

Moved site, make old links redirect with .htaccess? From sub.mydomain.com to mydomain.com

I recently moved my blog from http://blog.mydomain.com to http://mydomain.com My problem now is that I have sites linking to the old addresses. What can I put in my .htaccess file to make, for instance, http://blog.mydomain.com/my-post-title-here go to http://mydomain.com/my-post-title-here Thanks in advance! ...

Development deployment: how to achive edit-and-reload with JSP pages?

Out project uses WebLogic as web-server and uses mostly JSP for user interface. With standard setup it is possible to copy edited JSP files into the exploded deployment directory and WebLogic will automatically pick them up, recompile and serve new content through HTTP. However, is it possible to avoid copying at all, so that I just sa...

logback and symbolic links

How can you configure appenders symbolic links in logback? I use logback's support for uniquely named files (described here) to get separate logs for each run. I would also like to have a symbolic link (e.g. log.current) to point to the latest logger file. Does logback support symbolic link manipulation? Is there a better way to appr...

xcode collect2: ld returned 1 exit status - how to resolve?

From what I have read this is supposed to be when the linker (not exactly sure how that works) can't find a symbol. the symbol in question is: SCNetworkReachabilityCreateWithAddress as can be seen from the full error message below. the thing is that the correct framework is added to my target. xcode recognises the symbol OK, i.e. ther...

How do I make a symlink to every directory in the current directory that has the same name but has underscores replaced by dashes?

For instance, I suppose I have a directory that contains the following folders foo_bar baz What I would like to have is a bash command that will make a symlink foo-bar to foo_bar so it would look like this: foo-bar foo_bar baz I'm pretty sure I can write a Python script to do this, but I'm curious if there's a way to do this with b...

How to move a symlink to the trash?

I don't see any options for the FSPathMoveObjectToTrashSync() function for not following links. Here is what I have tried Create a link and a file [ 21:32:41 /tmp ] $ touch my_file [ 21:32:45 /tmp ] $ ln -s my_file my_link [ 21:32:52 /tmp ] $ la total 8 drwxrwxrwt 12 root wheel 408 17 Maj 21:32 . drwxr-xr-x@ 6 root wheel...

Component based web project directory layout with git and symlinks

I am planning my directory structure for a linux/apache/php web project like this: Only www.example.com/webroot/ will be exposed in apache www.example.com/ webroot/ index.php comp1/ comp2/ component/ comp1/ comp1.class.php comp1.js comp2/ comp2.class.php comp2.css lib/ lib1/ l...

PHP / Windows - Opendir() fails opening subdirectories within symbolic linked directories

Does anyone know a solution to this problem? I'm unable to open a subdirectory within a symboliclink'd directory. I've confirmed that the paths are correct (even copy & pasted the path into explorer, which parsed it fine). This is a strange, annoying, bug :|. Example: C:\folder\symbolic_link\dir1\dir2 - opening dir2 fails. C:...

Symlinking folders in bash

I want a folder /public_html to symlink to /current/app/webroot, both are in the same directory I have tried ln -s public_html current/app/webroot amongst other things, but no joy so far. Any ideas? ...

Getting the file name of files dropped on the script

...

What is a good way to simulate O_NOFOLLOW on systems without this flag?

I would like to safely be able to simulate open with O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW and O_CREAT | O_WRONLY | O_APPEND | O_NOFOLLOW on systems that do not support O_NOFOLLOW. I can somewhat achieve what I am asking for with: struct stat lst; if (lstat(filename, &lst) != -1 && S_ISLNK(lst.st_mode)) { errno = ELOOP; retu...

How to get java to recognize symbolic links under cygwin

Here's a very simple java program to print the first line of a file: import java.io.* public class test { public static void main(String[] args) throws IOException { System.out.print(new BufferedReader(new FileReader(args[0])).readLine()); } } When I run this program under cygwin and pass it the name of a symbolic link, it pri...

creating a union branch of a number of git branches

I'd like to be able to layer other branches on top of an existing branch, and have those branches be revisioned independently. This would be useful, for example, to allow the binaries for various subprojects to be unified into the same bin directory. In general a given file would only be present in one layer. Ideally I guess I would u...

Simulating O_NOFOLLOW (2): Is this other approach safe?

As a follow-up question to this one, I thought of another approach which builds off of @caf's answer for the case where I want to append to file name and create it if it does not exist. Here is what I came up with: Create a temporary directory with mode 0700 in a system temporary directory on the same filesystem as file name. Open fil...

Set apache documentRoot to symlink (for easy deployment)

we are looking for a way to point our Apache DocumentRoot to a symlink. E.g. DocumentRoot /var/www/html/finalbuild finalbuild should point to a folder somewhere like /home/user/build3 when we move a new build to /home/user/build4 we want to use a shell script that changes the symbolic link "finalebuild" to this new directory /home/user...

Typo3 extensions and symlinks

Can I create a symlink to the local extension from aonther project folder? I have a common local-server and i need to implement same extension on all local project-installations. I tried to put the symlink, but some times i do not get expected output. I get it only after clearing the cache of that perticular project. ...

Check if a symlink has changed

I have a daemon that, when it's started, loads its data from a directory that happens to be a symlink. Periodically, new data is generated and the symlink updated. I want a bash script that will check if the current symlink is the same as the old one (that the daemon started with) and if not, restart the daemon. My current thought is: i...

Does deleting temporary symlinks interrupt current downloads/access to that symlink?

I am using symlinks generated in PHP. They are generated when someone requests a download, and I want them to expire at the end of each day. The problem is, what if someone starts downloading a symlink 1 minute before the end of the day and then I delete the symlink while they are downloading it... My question is, to your knowledge wil...