can't get unlink to work on windows

jan_buys_at_hotmail.com
Date: 12/29/04


Date: 29 Dec 2004 08:29:34 -0800

Hi,

Hope this is a quickie for you toughened perl gods.

I am using unlink in a CGI script (server currently running under my
own admin account) but I can't get it to remove a file with the unlink
command. The script should be cross-platform, so I can't use a system
command for this :

code :
$remfn = $FilePath.$PlatformSlash.$NFN;
my $cnt = unlink (qw|"$remfn"|); # db too
open (DEBUG, "> test.txt"); # db
print DEBUG "$remfn, $cnt, $!"; # db
close (DEBUG); # db

my debug file then shows :
c:\Program Files\Apache
Group\Apache\htdocs\noticeboard\uploads\UPL_8848.upl
, 0, No such file or directory

Which is strange, because the file IS there.

btw : tried these variants too :
unlink "$remfn";
unlink ("$remfn");

Thanks for any help !



Relevant Pages

  • Re: cant get unlink to work on windows
    ... > I am using unlink in a CGI script (server currently running under my ... > own admin account) but I can't get it to remove a file with the unlink ... What you claim your debug file shows has line ... is it possible that $NFN has a trailing line feed as ...
    (comp.lang.perl.misc)
  • Cannot access file because it is being used by another process
    ... when trying to unlink a file I get the following message. ... Since I can't rename if the file exists, ... but if it's run as a CGI script if fails. ... Here's the relevant code: ...
    (perl.beginners)
  • Re: How to delete temporary file after displaying in browser ?
    ... unlink $file; ... main CGI script: ... work around this is that this script will be used on several servers, ... more documentation about script shell editing, about cronjob scheduling ...
    (comp.lang.perl.misc)
  • Re: How to delete temporary file after displaying in browser ?
    ... main CGI script: ... unlink $imgpath; ... unlink before quitting. ...
    (comp.lang.perl.misc)
  • Re: Moving /USR
    ... This was done from the command ... Once the upgrade was complete I just logged out and ... logged back in again and, bingo, I'm running Xorg now. ... you can't unlink them and create a new file with the same name. ...
    (uk.comp.os.linux)