Search code examples
linuxubuntu-14.04symlinkfinder

Symlinking doesn't work in Ubuntu


I tried ln -s ./storage/profile_pictures/* ./public/profile_pictures/ but that renders my images useless. In my Finder, it says image.png (alias), but in preview it doesn't show the picture, just a white page icon.

How do I fix this?


Solution

  • As morido said, you want public/profile_pictures to be a symlink to the directory storage/profile_pictures. So don't use ./storage/profile_pictures/*, because the shell will expand that to a list of all files in ./storage/profile_pictures/.

    Secondly, you're using a relative path:

    ln -s ./storage/profile_pictures ./public/profile_pictures
    

    says "make a symlink in ./public/profile_pictures that points to ./storage/profile_pictures". The first argument is relative to the second one. That is, you'd wind up with ./public/profile_pictures/profile_pictures which points to the directory ./public/profile_pictures/storage/profile_pictures, which presumably doesn't exist. The easiest way to do this is likely

    cd public
    ln -s ../storage/profile_pictures profile_pictures