Hello,
I'm a little confused on how to use wildcards in PHP.
Here is what I would like to do.
First check if a file exists, if it does I would like to rename it and then delete all other versions of the file.
Where the wildcard comes in before the "v" is the date ex 0623 (which of course will change daily). The wildcard after the "v" in the unlink() section will delete V2 if V3 exists and so on...
something like
<?php
if (file_exists("/home/mydir/page01v3.ps")) {
passthru("mv /home/mydir/page01v3.ps /home/mydir/page01.ps");
unlink("page01v.ps");
echo "A version 3 for file page01.ps was found and renamed.";
}
elseif (file_exists("/home/mydir/page01v2.ps")) {
passthru("mv /home/mydir/page01v2.ps /home/mydir/page01.ps");
unlink("page01v.ps");
echo "A version 2 for file page01.ps was found and renamed.";
}
elseif (file_exists("/home/mydir/page01v1.ps")) {
passthru("mv /home/mydir/page01v1.ps /home/mydir/page01.ps");
unlink("page01v.ps");
echo "A version 1 for file page01.ps was found and renamed.";
}
else {
echo "No page01.ps could be found on the server";
?>
Thanks