title: comparing two unix time files to delete old files
body: <p>I am using the below bit of code to get the <code>timestamps</code> of files on my cloud server and then delete any that are over a certain age. </p>
  
  <p>For now the code is set to delete anything older than 10 minutes for testing. </p>
  
  <p>However it deletes everything, even if I upload some files then run the script 10 seconds later.</p>
  
  <p>Is there some small problem I am not seeing?</p>
  
  <pre><code>    $auth-&gt;authenticate();
  
      //connect
      $conn = new CF_Connection($auth);
  
      //create a handle for the CLOUD FILES container we want to delete from
      $daily_dose = $conn-&gt;get_container('daily_dose');
  
      //delete the obeject 
      $daily_packages = $daily_dose-&gt;list_objects();
      //print_r($daily_packages);
      //$public_container = $conn-&gt;get_container("public");   
  
      //$file_age = 86400; // 1 day in seconds
      $file_age = 600; // 10 minutes
  
      echo 'current time: ';
      echo $current_time = time();
      echo '&lt;br&gt;';
      echo 'time offset: ';
      echo $previous_day = $current_time - $file_age;
      echo '&lt;br&gt;';
  
      foreach($daily_packages as $package)
      {   
          echo $item = $daily_dose-&gt;get_object($package);
          $modified = $item-&gt;last_modified;
          echo ' ' . $modified;
          echo ' -&gt; ' . strtotime($modified);
          echo '&lt;br&gt;';
  
          //If the modified time of the file is less the current time - 1 day in seconds (older than 1 day) delete it
          if ( $modified &lt; $previous_day )
          {
              //delete the file
              $daily_dose-&gt;delete_object($item);
          }
      }
  </code></pre>