Help about mass renamer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help about mass renamer

    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

    #2
    Post your code here so we'll have a look at it
    libra.wen.ru

    Comment


      #3
      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


        #4
        seems like its either permission or ownership matters of the files ...

        change the ownership of files to default account .

        Comment


          #5
          lol
          u have to update ur database to see the effect.

          Comment


            #6
            i have run this script in 755,777 but nothing happen and pflash do u think am i fool grrrrrrrrrrrrrrrrrrrrrrrrrr

            Comment


              #7
              Originally posted by surajpawaar View Post
              i have run this script in 755,777 but nothing happen
              try to change the ownership of the files from root to default account you are using

              Comment


                #8
                thanx problm solved :D

                Comment

                Working...
                X