How to rename multiple files in multiple folders with 1 command
        Posted  
        
            by 
                Charles
            
        on Super User
        
        See other posts from Super User
        
            or by Charles
        
        
        
        Published on 2012-03-21T11:00:55Z
        Indexed on 
            2012/03/21
            11:32 UTC
        
        
        Read the original article
        Hit count: 290
        
Windows
|batch-rename
We want to rename our *.html files to *.php but (sadly enough) have not enough knowledge to do it with a dos batchfile and/or cmd prompt command.
The problem is that each file is in seperat folder and yes talking about 1500+ different folder names. Using wildcards for the files I know is the '*' but using also a wildcard for folders is unknown to me. We probably need to use the (MSDOS) 'FOR' command but there I am stucked.
Folder structure we use is:
parent-folder/child-folder/grandchild-folder/file.html
sample:
games/A/game_name/file.html, games/B/game_name/file.html, games/C/game_name/file.html and so on.
The parent folder is for all files the same, the child & grandchild folders are different for most files.
After renaming these files to .php I assume following in the .htaccess will make a permanent redirect. RedirectMatch 301 (.).html$ http://oursite.com$1.php
Looking forward to suggestions/answers, thnx in advance.
© Super User or respective owner