simun Posted December 15, 2009 Share Posted December 15, 2009 i have a two files 1.vot and 2.vot, i wish to make a php script that check when one of this files is modified and then to copy its content to another file, it is posible to do that? Quote Link to comment Share on other sites More sharing options...
dgoosens Posted December 15, 2009 Share Posted December 15, 2009 I guess you could simply use filemtime() to check the modified date but you'll have to use CRON or something to launch the request every XX seconds/minutes/hours ... http://php.net/manual/en/function.filemtime.php Quote Link to comment Share on other sites More sharing options...
simun Posted December 15, 2009 Author Share Posted December 15, 2009 the problem is that i dont know how to launch request every x seconds, is there any scrypt to do that? or maybe i can put filemtime() script on my index.php page to check the lastest modified file on every reload and to copy its content to another file? Quote Link to comment Share on other sites More sharing options...
dgoosens Posted December 15, 2009 Share Posted December 15, 2009 or maybe i can put filemtime() script on my index.php page to check the lastest modified file on every reload and to copy its content to another file? that 'll work... however, do have a look at CRON... it basically CRON is a services installed on your server that launches a PHP script every xx seconds. a quick google on CRON and PHP gave me quite some interesting results http://articles.sitepoint.com/article/introducing-cron# is one of them Quote Link to comment Share on other sites More sharing options...
simun Posted December 15, 2009 Author Share Posted December 15, 2009 now i can check what file i newer vith this: $filename_hr = 'quickpolls/data/1227711666.vot'; $filename_it = 'quickpolls/data/1259074716.vot'; $hr_vrijeme = date (filemtime($filename_hr)); $it_vrijeme = date (filemtime($filename_it)); if ($hr_vrijeme > $it_vrijeme) {echo "hr is new";} else {echo "it is new";} How can i make now that content from newer file is copied to older file? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.