cannot create symbolic link on CentOS 5.6 - File exists error

5,296

You should check if dev_crmpicco/web exists from a previous attempt to link (or from copying instead of moving). You would have to remove that if it exists (whether file, link or directory) as that is what you command tries to create.

After checking that try:

ln -s ~/vhosts/dev/dev_crmpicco/web/ dev_crmpicco

without the trailing / as @Johan suggested.

Share:
5,296

Related videos on Youtube

crmpicco
Author by

crmpicco

Senior Analyst Developer (MoodleCloud) at Moodle, AWS Solutions Architect (Associate), Zend Certified Engineer and Google Analytics Qualified Individual

Updated on September 18, 2022

Comments

  • crmpicco
    crmpicco almost 2 years

    I am trying to setup a symbolic link on my CentOS 5.6 machine to point dev_crmpicco/ to ~/vhosts/dev/dev_crmpicco/web/

    I am using the following command:

    [crmpicco@devel dev]$ ln -s ~/vhosts/dev/dev_crmpicco/web/ dev_crmpicco/
    

    However, I get this error:

    ln: creating symbolic link `dev_crmpicco/web' to `/home/crmpicco/vhosts/dev/dev_crmpicco/web/': File exists
    

    I'm aware the file exists as I want dev_crmpicco/ to point to it.

    Basically, my DOCROOT used to be in dev_crmpicco/ but now it is all moved into a web/ directory and I don't want to have to go round changing all my Apache config and i'd rather do it through a symlink if at all possible.