Scandir Seems To Display Files I Have Deleted/Moved
Posted: Fri Jul 18, 2008 1:54 pm
Hey,
Does anybody know why the scandir function, when you print out the results of using this with a directory, doesn't show the true updated list of files? For instance, if I use
scandir($path) and then print out the files, everything *looks* normal
However, I have found that if I delete one file in that directory and re-print out the files using scandir, that file still appears in the array!
This works with a firefox browser re-boot, session logout etc. Does anybody know why that is? Is there a way around it or do I just have to use
other methods? (Which is fine, I found a way around it but I just cannot believe what I saw with this function)
Thanks for your time.
PS. For those who are curious, this is what I did
Does anybody know why the scandir function, when you print out the results of using this with a directory, doesn't show the true updated list of files? For instance, if I use
scandir($path) and then print out the files, everything *looks* normal
However, I have found that if I delete one file in that directory and re-print out the files using scandir, that file still appears in the array!
This works with a firefox browser re-boot, session logout etc. Does anybody know why that is? Is there a way around it or do I just have to use
other methods? (Which is fine, I found a way around it but I just cannot believe what I saw with this function)
Thanks for your time.
PS. For those who are curious, this is what I did
Code: Select all
$zipfile = scandir("/home/path/to/directory"); // just point this to a directory with some zip files
print_r($zipfile); // this displays the contents.