<?php

if ($handle = opendir(PUBPATH . "global/uploads/" )) {
    while (false !== ($fileName = readdir($handle))) {
        $newName = str_replace("oldfile_","",$fileName);
        rename($fileName, $newName);
    }
    closedir($handle);
}
echo 'hiiiiiiii';exit;

//                         $allfiles = glob($dir.'/*.*');
//                        // lop to get filesnames
//            foreach ($allfiles as $fl) { 
//                $files = array_filter($fl, 'is_file');
//                echo 'hiiii';
//            //    print($files);
//
//            }
// Read files
//$files = scandir($dir);
//// Filter out non-files ('.' or '..')
//$files = array_filter($files, 'is_file');
//// Create associative array ('filename' => 'filename.mp3')
//$files = array_combine(array_map('basename', $files), $files);
//vbranch_dump($files);
           //  foreach ($rename_photos as $ph) { 
//                if (file_exists(PUBPATH . "global/uploads/" . $ph['ph_url'])) { 
//                  //  rename(PUBPATH . "global/uploads/" . $ph['ph_url'], PUBPATH . "global/uploads/" .'oldfile_'.$ph['ph_url']);
//                    }  else {
//                 
//                    }
//                }
