Skip to content

Instantly share code, notes, and snippets.

@chakravarthykalyan90
Created August 22, 2018 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chakravarthykalyan90/27ddafc57c9d65cd788ff0fea224cc84 to your computer and use it in GitHub Desktop.
Save chakravarthykalyan90/27ddafc57c9d65cd788ff0fea224cc84 to your computer and use it in GitHub Desktop.
<?php
$dir = "/var/www/html/location/";
chdir($dir);
array_multisort(array_map('filemtime', ($files = glob("*.*"))), SORT_ASC, $files);
foreach($files as $filename)
{
echo "<li>".substr($filename, 0, -4)."</li>";
rename($filename, '/var/www/html/location/archive/'.$filename);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment