deleting files with perl
Ok I've consulted my PERL books, I've searched this forum, but for somereason I can't seem to delete a file from within my perlscript. I am using unlink like this..
CODE------------
unlink ("../sites/$num.shtml");
CODE------------
Is there something wrong with this code? Or does the file have to have certain permissions to be deleted by the script?
Thanx
VulKen
Pimpin like a pimp with an electrofied pimpin machine!
richjb posted this at 15:46 — 14th June 2000.
They have: 193 posts
Joined: Feb 2000
I don't use the parenthesis, but I doubt that matters. Also, I think it is only your example, but I don't believe PERL will handle relative paths like that?
If you think it might be the permissions, try chmoding the file to 755 then deleting it:
[email protected]
Everyone here has a website. It's just that not all are worth posting (Mine! ).
Orpheus posted this at 20:31 — 14th June 2000.
They have: 568 posts
Joined: Nov 1999
CGI scripts are executed as user "nobody". Unless your using SUSEXEC (is that right?). So if your server admin has set it so that you can't delete files as user "nobody" than it's impossible.
Unless he'll activate that program, then you can execute commands as your own user name.
But that's all useless if your on windows OS.
richjb posted this at 02:04 — 15th June 2000.
They have: 193 posts
Joined: Feb 2000
Orpheus,
Your probably right. My server automatically runs my scripts as user "ME." That way I don't have to worry about anything.
Create a file called whoami.cgi Put the following code in it:
[email protected]
Everyone here has a website. It's just that not all are worth posting (Mine! ).
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.