0

Is there a possibility to periodically check a directory for changes (file added) in CakePHP?

If a new file appears in this directory I would like to get its name.

jh314
  • 27,144
  • 16
  • 62
  • 82
stackoverflow
  • 73
  • 1
  • 4
  • possible duplicate of [Is there a way to detect changes in a folder using php on both windows and linux?](http://stackoverflow.com/questions/13002348/is-there-a-way-to-detect-changes-in-a-folder-using-php-on-both-windows-and-linux) – ndm May 27 '15 at 15:18

1 Answers1

1

There's no built in function in cakephp to archive this.

periodically: php scripts are usually fired by request and not cyclic - to do so you can use a simple cron or some advanced jobserver like gearman(https://github.com/davidsteinsland/cakephp-gearman)

check a directory for changes:Php is not the perfect language to do stuff like this but if you really want to you can do so, by using a solution proposed here: Is there a way to detect changes in a folder using php on both windows and linux?

The better option would be to take a more suited language and only post the findings to some php script(if at all). A cyclic execution for other languages can also be scheduled via some cronjob, a more powerful job server, or dependent on the language on build in scheduling functions.

Community
  • 1
  • 1
Lukasstr
  • 435
  • 2
  • 19