PHP users,
Hope you can help:
(1) user upload file(s) to directory /dir/jdoe
(2) a script will run, ONCE a day, to see if there is any file(s). If there is, tar the file(s), give it a new name, example: tarfile012302.tar. tarfile is from other variable(remain static: what a oxymoron term, static variable), 012302 is from function: date("mdy", time()).
This script works great. But now the requirement has been changed. The script may need to be run more then once, or twice, or whatever times deem necessary. Certainly, the already tar file will be overwritten since the only thing to distinguish the file name is from the date function. Once a day is fine, but more then once I am going to have trouble.
I was thinking to add the minute and second to it. Can there be a better way? The file name will be LONG!
WHile you are at it, how do I detect and deal with the situation when the script runs at the same time users are uploading file(s).
I was thinking to check to see if file exists, if it does, check for file size, then wait/sleep (can it be done??? Is there such a thing in PHP?) then go back again to check for file size. If file size remains the same, execute tar operation, if not, wait/sleep some more... Any suggestion/pointer to other reading material and/or sample code will be greatly appreciated 🙂
Thanks