I am currently making a php script to graph a bunch of data from a DB, arrange it into text files and then run a GNUPlot script to generate graphs. I have all of this working , now all I need to do is delete the text files I don't need anymore.
What I have been trying was gotten from another thread on a different forum:
foreach( glob('US_A.2.6.*') as $file )
{
unlink($file);
}
The problem, however, is that it doesn't work. The files have complex end names:
And more.
Check your working directory with getcwd(). If you are not in the same directory as your text files, you will need to specify the path.
Also, try echoing the output of the glob() statement to see if it is finding any files:
echo $file . PHP_EOL;
unlink($file);
You are not checking the unlink() return value, so it could be failing silently (depending on your error_reporting level) if the files are unwritable.