How to check if a directory/file/symlink exists with one command in Ruby

The standard File module has the usual file tests available: RUBY_VERSION # => “1.9.2” bashrc = ENV[‘HOME’] + ‘/.bashrc’ File.exist?(bashrc) # => true File.file?(bashrc) # => true File.directory?(bashrc) # => false You should be able to find what you want there. OP: “Thanks but I need all three true or false” Obviously not. Ok, try … Read more

Remove a symlink to a directory

# this works: rm foo # versus this, which doesn’t: rm foo/ Basically, you need to tell it to delete a file, not delete a directory. I believe the difference between rm and rmdir exists because of differences in the way the C library treats each. At any rate, the first should work, while the … Read more

What is the difference between NTFS Junction Points and Symbolic Links?

Symbolic links have more functionality, while junctions almost seem to be a legacy feature because of their limitations, but the security implications of these limitations are specifically why a junction might be preferred over a symbolic link. Remote targeting makes symbolic links more functional, but also raises their security profile, while junctions are safer because … Read more

How to make a symbolic link with Cygwin in Windows 7

In short, define the following environment variable: CYGWIN=winsymlinks:nativestrict According to Cygwin documentation: If set to winsymlinks:native or winsymlinks:nativestrict, Cygwin creates symlinks as native Windows symlinks on filesystems and OS versions supporting them. The difference between winsymlinks:native and winsymlinks:nativestrict is this: If the filesystem supports native symlinks and Cygwin fails to create a native symlink for … Read more