Deleting a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chanshaw
    New Member
    • Nov 2008
    • 67

    Deleting a file

    Can't seem to get this to delete the file, ive tried setting the permissions but it still won't delete.

    Code:
    my $fileName = 'c:\inetpub\wwwroot\guessingGame\guessingGame.csv'; 
    unlink($fileName);
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    Originally posted by chanshaw
    Can't seem to get this to delete the file, ive tried setting the permissions but it still won't delete.

    Code:
    my $fileName = 'c:\inetpub\wwwroot\guessingGame\guessingGame.csv'; 
    unlink($fileName);
    Please reply to the threads you start.

    Try this, see what $! returns:

    Code:
    my $fileName = 'c:\inetpub\wwwroot\guessingGame\guessingGame.csv'; 
    unlink($fileName) or die "Can't delete file $filename : $!";
    There is nothing patently wrong with your usage so either its a wrong path or the file is not closed or some other issue.

    Comment

    Working...