We help IT Professionals succeed at work.

Unlink on windows server not working..

noelh
noelh asked
on
Medium Priority
750 Views
Last Modified: 2012-05-05
Why won't the Unlink function work on my windows web account?

NH
Comment
Watch Question

it has to !

you prabaly are doing sth wrong ...

:)
pl be more specific what happens :))

Commented:
noelh,

suggest you have a quick look at the following articles to make sure you using the function correctly:

The only problem aside from this is that apparently on aw indows server unlink will not delete directories only files.

here's the excerpt i found:

unlink(LIST)
unlink LIST
Deletes a list of files. Returns the number of files successfully deleted.
     $cnt = unlink 'a', 'b', 'c';
     unlink @goners;
     unlink <*.bak>;

Note: unlink will not delete directories unless you are superuser and the -U flag is supplied to perl. Even if these conditions are met, be warned that unlinking a directory can inflict damage on your filesystem. Use rmdir instead.

http://tech.irt.org/articles/js127/

http://www-2.cs.cmu.edu/People/rgs/pl-exp-file.html
CERTIFIED EXPERT

Commented:
noelh,

"..Why won't the Unlink function work on my windows web account?.."

Can you please post your entire script here?

Also, please provide a brief idea of what exactly you are trying to do.

This will help you get a more accurate answer, faster.

Let me know.
Commented:
Indeed, make sure your web account has permission to delete the file.

Check the error logs as well. And, run the unlink like:

unlink($sFile) || print STDERR "Couldn't delete file [$sFile] $!\n";

Mr B

Explore More ContentExplore courses, solutions, and other research materials related to this topic.