Deleting a Symbolic Link
Deleting a symbolic link should be easy, right? Try doing it with an FTP client. If you have shell access to your host, it is easy.
I used to have unused symbolic links all over the place. I could rename them, but I couldn't delete them. Recently, I remembered the PHP unlink function and used it to delete them all.
The steps to use it are:
1) Rename the symbolic link to something like "delete_me" in order to reuse the same PHP file.
2) Create the PHP file with the appropriate code. I used "unlink.php". Simple and easy to remember.
3) Upload the PHP file to the directory containing the link.
4) Type in the URL to the file.
The result is that the file disappears without a trace.
This is the PHP code I used.
<?php
unlink ('delete_me');
?>
You techies and coders will probably laugh at this, but you don't know how many times I've been asked to explain it.
Similar Posts:


Luckily I have shell access to my server. :grin:
My latest blog post: Boxi and Panjo – Late Night Movie
I don't and you're evil! :twisted:
If I ever stop being evil, I'll probably resort to using this method.
Me too :)
Nice use of PHP though.I think the idea of using PHP for maintenance on files is pretty cool.
My latest blog post: Slackware vs Kubuntu: A Subjective Review
I don't think this would work for files which are owned by anybody other than the "www" user which is what PHP runs as. If files are owned by the normal UNIX user, then this wouldn't work as it would deny permission.
My latest blog post: Boxi and Panjo – Late Night Movie
Well, it wouldn't be necessary.
My site is in PHP and I have no idea what a symbolic link is. I'm not much of a techie as you can guess. Will google it right away.
This method scares me — why not get a better host with shell access?
My latest blog post: Missing Google Maps Mobile v2.2.0 on a Windows Mobile phone
Some of don't have the luxury of choice.
I'm not sure if I understand that, how can you not have choice?
In my case, I live in the Philippines, but Philippines web hosting isn't good and is much more expensive than the U.S. My host is in the U.S. and because of fraud prevention, I had to call them at 40 cents per minute just to prove who I was.
Switching hosts, which I did 3 times, gets to be rather expensive by long distance.
If you'd like, I can set you up with my hosting company, we're cheap and try to help you with anything you need. (Not really trying to sell you, just an option.)
Any why not use Skype? Gotta be cheaper. :P
Shoot me the name of the host and when this subscription expires, I'll consider it.
At the time I signed up, I couldn't even get a decent DSL connection (things started working since then) or I would have used Skype. In fact, I use Skype now to talk to my wife every day for about $6 something a month.
[...] Por si alguien más se encuentra en este pequeño apuro, ahí os dejo el enlace a este truquito: Deleting a symbolic link. [...]
Just wanted to say thanks for this handy trick! Helped in a tough spot when I didn't have shell access and had a stuck symbolic link!