Forum Moderators: coopster

Message Too Old, No Replies

File Delete

         

crankshaft

12:45 pm on Oct 8, 2005 (gmt 0)

10+ Year Member



Hi All;

I need to delete a compressed backup file after it has been sucessfully uploaded to a ftp server, the upload works fine using CRON and a php page.

I have tried to delete the file using:

<?
$oldfile = "/home/#*$!/backup-10.8.2005_07-00-01_yyy.tar.gz";
unlink($oldfile);
?>

However I get a permission denied, what's wrong?

Also, I don't know the exact file name, so what I really want to do is wildcard the file name like this:

<?
$oldfile = "/home/xxx/backup-*_yyy.tar.gz";
unlink($oldfile);
?>

Is this possible?

Thanx

PeterC

henry0

2:02 pm on Oct 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



crankshaft
Fresh from the PHP manual!


before you could unlink a file created which uses a handle e.g.,

$handle = sqlite('temp.db');

unset($handle); first befofe
unlink($handle);

to avoide permission denied error.