I have created a script to backup a database. The script first checks for the day, then uses the day's name for the directory (Sunday, Monday, Tuesday, etc.). Then it deletes all files from that directory. Finally, it 'creates/saves' the new files to the directory.
Ok, the problem:
In one directory, the is_file() does not recognize the files as files... it reads them (using $dirName->read()), but NO files in this directory pass the is_file() test. To make things more curious, the files are also not deleted by unlink(). The is_dir() test works fine and reads . and .. as directories. The files are not mistaken for directories either.
The permissions on the directories are all the same (0777). The script is running as a cron job and it 'logs in' as the same user each day.
Server: Linux/Apache 2.0, PHP 4.3.8
Anyone got any ideas?? Thanks!
Files not seen as files (and won't unlink)
Moderator: General Moderators
-
seveninstl
- Forum Newbie
- Posts: 4
- Joined: Fri May 14, 2004 12:38 pm
- Location: Kissimmee, FL
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
-
seveninstl
- Forum Newbie
- Posts: 4
- Joined: Fri May 14, 2004 12:38 pm
- Location: Kissimmee, FL
Solved
Solved it myself (with indirect help). In case anyone is wondering what I did...
I changed my search criteria this morning and found other posts that were similar to mine. In one "timvw" gave some advice that I tried and it worked.
I was using:
But should have been using:
I'm not really sure why my original code worked on some directories and not others. But, by adding the path, it now works on all directories.
Thanks timvw, even if the help was indirect
I changed my search criteria this morning and found other posts that were similar to mine. In one "timvw" gave some advice that I tried and it worked.
I was using:
Code: Select all
<?php
if (is_file($contents))
?>Code: Select all
<?php
if (is_file($dirName->path."/".$contents))
?>Thanks timvw, even if the help was indirect
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia