i have vps hosting in x10hosting.com my site is surajmob.in when i try to rename files script say that rename was successfull but actually not any reflect can anyone help me about this
Help about mass renamer
Collapse
X
-
here is code
Code:<?php ///Mass Renamer/// // the directory // './' - is the current directory // '../' - is the parent directory // case sensitive // e.x.: /home/user or c:\files $dir='./'; // 1 - uppercase all files // 2 - lowercase all files // 3 - do not uppercase or lowercase $up=3; //rename files that have $w in their filename //case sensitive //set to '' if you want to rename all files $w=''; //do not rename files having $n in their filename $n=''; //add prefix to files $prefix=''; //add postfix $postfix=''; //replace $replace='MirChi.Mobi'; $replace_with='SurajMob.In'; //true - traverse subdirectories //false - do not traverse subdirectories $tr=true; ////// do NOT change anything below this ///////// set_time_limit(120); $files=array(); error_reporting(E_ERROR | E_PARSE); function prep($f,$dir) { global $up,$prefix,$postfix,$w,$replace_with,$replace,$n,$files; if(strpos($f,$n)!==false) return $f; $f=str_replace($replace,$replace_with,$f); if($up==1) $f=strtoupper($f); elseif($up==2) $f=strtolower($f); $f=$prefix.$f.$postfix; $files[]=$dir.$f; return $f; } $i=0; function dir_tr($dir) { global $i,$w,$tr,$files; $dir=rtrim(trim($dir,'\\'),'/') . '/'; $d=@opendir($dir); if(!$d)die('The directory ' .$dir .' does not exists or PHP have no access to it<br><a target="_blank" href="http://phpadda.in">Need help?</a>'); while(false!==($file=@readdir($d))) { if ($file!='.' && $file!='..' && $file!='renamer.php') { if(is_file($dir.$file)) { if($w=='' || (strpos($file,$w)!==false)) { if(!in_array($dir.$file,$files)) { rename($dir.$file,$dir.(prep($file,$dir))); $i++; } } } else { if(is_dir($dir.$file)) { if($tr) dir_tr($dir.$file); } } } } @closedir($d); } dir_tr($dir); echo '<br>Renamed ' . $i . ' files in directory<br>' . $dir; echo "<br>You can now delete renamer.php"; ?>
Comment
Comment