title: Deleting files in directory after one minute
body: <p>i think this question was asked few times, which I have went through and was using some of the code from the net. Right now Im encountering problem with the time. </p>
  
  <p>Let me furnish the code first:</p>
  
  <pre><code>&lt;?php
     $pathToDir = getcwd();               
  
     $pathToFilesDir = $pathToDir . '\files';
  
     $pathToFiles = $pathToFilesDir . '\\';
  
      if ($handle = opendir($pathToFilesDir)) {
  
          while (false !== ($file = readdir($handle))) { 
  
              $filelastmodified = filemtime($file);
  
              if ($file != '.' &amp;&amp; $file != '..'){               
  
                  if((time() - $filelastmodified) &gt; 60 &amp;&amp; is_file($file)){
  
                      unlink($pathToFiles . $file);
  
                  }                
              }                 
          }
          closedir($handle); 
      }
  
  ?&gt;
  </code></pre>
  
  <p>This was what I was trying, to auto delete the files which are one minute older. Just for testing purposes I was trying for one minute. The result is that the files dont get deleted. On the other hand I just removed this timing condition </p>
  
  <pre><code>if((time() - $filelastmodified) &gt; 60 &amp;&amp; is_file($file))
  </code></pre>
  
  <p>and ran the script, which could delete the files immediately.</p>
  
  <p>Can any one spot the mistake which I am making?</p>
  
  <p>Thanks
  Raaks</p>