migration - How to remove symlink from folder

I have a WordPress installation on a bad server that I want to migrate.I tried to make a backup via some WordPress plugi

I have a WordPress installation on a bad server that I want to migrate.

I tried to make a backup via some WordPress plugins, but it was taking forever, generating an enormous zip file.

I asked help from my host support but they haven't replied since.

Looking for a solution I found a www symlink inside the www folder, which is causing the backup to run recursively, re-backing up the entire site again and again, never completing.

I installed the two most known file manager plugins, but both could not delete this symlink, returning an error.

Knowing that I don't have a FTP access, how do I manage to get rid of this symlink?

Is there a plugin that can handle symlinks? Or any way to run a command line to delete this thing?

I have a WordPress installation on a bad server that I want to migrate.

I tried to make a backup via some WordPress plugins, but it was taking forever, generating an enormous zip file.

I asked help from my host support but they haven't replied since.

Looking for a solution I found a www symlink inside the www folder, which is causing the backup to run recursively, re-backing up the entire site again and again, never completing.

I installed the two most known file manager plugins, but both could not delete this symlink, returning an error.

Knowing that I don't have a FTP access, how do I manage to get rid of this symlink?

Is there a plugin that can handle symlinks? Or any way to run a command line to delete this thing?

Share Improve this question edited Sep 27, 2016 at 20:50 Ethan Rævan 4,0295 gold badges27 silver badges55 bronze badges asked Sep 27, 2016 at 20:42 Carlos ABSCarlos ABS 1013 bronze badges 1
  • 1 Get a new host. No one that deals with code doesn't have FTP access. – Nathan Powell Commented Sep 28, 2016 at 6:11
Add a comment  | 

2 Answers 2

Reset to default 1

Do you have any access to the server? SSH access? If you can get to a command line on the server you could try one of these commands. Using sudo would try and run the command as an administrator, so you would need a password:

unlink /path/to/symlink

sudo unlink /path/to/symlink

rm /path/to/symlink

sudo rm /path/to/symlink

I made it, inserted this code in the functions.php file and it worked:

function remove_symlink() {
    $linkfile = 'www'; //symlink to delete
    $old = getcwd(); // Save the current directory
    chdir($_SERVER['DOCUMENT_ROOT']); //Location of the file to be deleted

    if(file_exists($linkfile)) {
        if(is_link($linkfile)) {
            unlink($linkfile);
        } else {
            exit("File exists but not symbolic link\n");
        }
    }
    chdir($old); // Restore the old working directory ;
}

remove_symlink();

Note that you need to change the current working directory (chdir) to the symlink directory you want to delete.

Thanks for the insights!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745299152a4621327.html

相关推荐

  • migration - How to remove symlink from folder

    I have a WordPress installation on a bad server that I want to migrate.I tried to make a backup via some WordPress plugi

    8小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信