Added support for linked files/directories. Treats them as directories and then falls back to opening as a file if the 'ls' fails.