Scheduled Synology Task with PHP

时间:2016-02-12 19:32:11

标签: php synology

Either synology won't let me do this, or my php script is bad

I've created my user defined script, so I used this as the script to call "php /volume7/homes/admin/scripts/ach_clean.php"

enter image description here

    <?php
  $files = glob(cacheme_directory()."/volume6/corp/AcctsPayable/*");
  $now   = time();

  foreach ($files as $file)
    if (is_file($file))
      if ($now - filemtime($file) >= 60 * 60 * 24 * 7) // 7 days
        fopen($file + ".test", "w");
        //unlink($file);
?>

1 个答案:

答案 0 :(得分:0)

forget PHP. It doesnt work as needed.

I just use shell instead. Simple, one liner.

find /volume6/corp/AcctsPayable/ -mindepth 1 -mtime +7 -delete