+ Reply to Thread
Results 1 to 6 of 6

Thread: Changing Directorise Using DOS

  1. #1
    Wirererer Masogir's Avatar
    Join Date
    Mar 2008
    Posts
    292

    Default Changing Directorise Using DOS

    Since all of the steamid's have changed from STEAM_0* to STEAM_1*, is anybody up to the task of creating a batch file which changes the name of multiple directories? I have hundreds of folders in my server's advanced duplicator that need to be changed and I'm just too lazy to change them all by hand.

    The DOS command REN or RENAME only works for files (Not folders).

    I know this isn't a DOS help forum, but come on... somebody here has to know DOS.... PB?

  2. #2
    Wire Sofaking ahref's Avatar
    Join Date
    Jul 2008
    Posts
    520

    Default Re: Changing Directorise Using DOS

    EDIT: Wait what steam ids haven't changed?

    lua could do this and i could do it in php

  3. #3
    Wire Sofaking ZeikJT's Avatar
    Join Date
    Dec 2008
    Location
    California
    Posts
    1,391

    Default Re: Changing Directorise Using DOS

    There are programs to do that; google: "batch folder rename"
    example freeware: How To Get All Files Tree | THE Rename reviews and free downloads
    Against stupidity the Gods themselves contend in vain.
    -Friedrich Schiller

    The flame puts me in the mood to "Do it!".
    -Dart, Legend of Dragoon

  4. #4
    Wire Sofaking ahref's Avatar
    Join Date
    Jul 2008
    Posts
    520

    Default Re: Changing Directorise Using DOS

    i got fed up with downloading free trials of renamers so coded my own little one in php
    it uses a folder listing function from PHP - List Of Folders | DreamInCode.net
    you'll need php ofcourse :
    Code:
    <?php
    function folderlist(){
      $startdir = './';
      $ignoredDirectory[] = '.';
      $ignoredDirectory[] = '..';
       if (is_dir($startdir)){
           if ($dh = opendir($startdir)){
               while (($folder = readdir($dh)) !== false){
                   if (!(array_search($folder,$ignoredDirectory) > -1)){
                     if (filetype($startdir . $folder) == "dir"){
                           $directorylist[$startdir . $folder]['name'] = $folder;
                           $directorylist[$startdir . $folder]['path'] = $startdir;
                       }
                   }
               }
               closedir($dh);
           }
       }
    return($directorylist);
    }
    
    $folders = folderlist();
      foreach ($folders as $folder){
        $path = $folder['path'];
        $name = $folder['name'];
    	if (strpos($name,"STEAM")) {
    		$rename = explode("_",$name);
    		array_shift($rename);
    		array_shift($rename);
    		echo("STEAM_1"."_".$rename[0]."_".$rename[1]);
    		rename($name,"STEAM_1"."_".$rename[0]."_".$rename[1]);
    	}
      }
    ?>
    just place it in the adv duplicator folder . for php people i realise theres better ways to do this but i had to write this at 4am
    Last edited by ahref; 02-17-2009 at 08:50 AM. Reason: oops damn brackets

  5. #5
    Wirererer Masogir's Avatar
    Join Date
    Mar 2008
    Posts
    292

    Default Re: Changing Directorise Using DOS

    Quote Originally Posted by ahref View Post
    i got fed up with downloading free trials of renamers so coded my own little one in php
    it uses a folder listing function from PHP - List Of Folders | DreamInCode.net
    you'll need php ofcourse :
    Code:
    <?php
    function folderlist(){
      $startdir = './';
      $ignoredDirectory[] = '.';
      $ignoredDirectory[] = '..';
       if (is_dir($startdir)){
           if ($dh = opendir($startdir)){
               while (($folder = readdir($dh)) !== false){
                   if (!(array_search($folder,$ignoredDirectory) > -1)){
                     if (filetype($startdir . $folder) == "dir"){
                           $directorylist[$startdir . $folder]['name'] = $folder;
                           $directorylist[$startdir . $folder]['path'] = $startdir;
                       }
                   }
               }
               closedir($dh);
           }
       }
    return($directorylist);
    }
    
    $folders = folderlist();
      foreach ($folders as $folder){
        $path = $folder['path'];
        $name = $folder['name'];
    	if (strpos($name,"STEAM")) {
    		$rename = explode("_",$name);
    		array_shift($rename);
    		array_shift($rename);
    		echo("STEAM_1"."_".$rename[0]."_".$rename[1]);
    		rename($name,"STEAM_1"."_".$rename[0]."_".$rename[1]);
    	}
      }
    ?>
    just place it in the adv duplicator folder . for php people i realise theres better ways to do this but i had to write this at 4am
    Very nice job, but they just fixed this with the latest svn ^_^.
    Last edited by Masogir; 02-17-2009 at 02:10 PM.

  6. #6
    Wire Sofaking ahref's Avatar
    Join Date
    Jul 2008
    Posts
    520

    Default Re: Changing Directorise Using DOS

    i know oh well

+ Reply to Thread

Similar Threads

  1. Changing wire without changing wire?
    By CDRW in forum Wiremod Addons & Coding
    Replies: 4
    Last Post: 10-04-2008, 11:05 AM
  2. Value changing error
    By andyator in forum Bug Reports
    Replies: 10
    Last Post: 09-03-2008, 06:49 AM
  3. Fun with changing weights
    By mjmr89 in forum Wiremod General Chat
    Replies: 5
    Last Post: 04-11-2008, 04:18 AM
  4. Changing Models!
    By Vicious3745 in forum Installation and Malfunctions Support
    Replies: 7
    Last Post: 12-15-2007, 07:12 AM
  5. Changing values
    By snakeface in forum Installation and Malfunctions Support
    Replies: 1
    Last Post: 05-27-2007, 01:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots