?
Solved

Renaming multiple files in multiple directories using ms-DOS

Posted on 2005-02-24
4
Medium Priority
?
2,544 Views
Last Modified: 2008-01-09
I would like to change multiple .asp file extensions to .html.

I have thousands of files and many directories. I would like to change all the .asp file extensions in the entire site at once.

I know you can use the ren command in ms-dos to rename all  files in the directory (i.e. ren "*.asp" "*.html") but this  only works in one directory. How can I have it rename files in subdirectories and sub-subdirectories too?
0
Comment
Question by:crchambers
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Assisted Solution

by:Nirmal Sharma
Nirmal Sharma earned 180 total points
ID: 13400025
did you try /s switch with rename ?
0
 
LVL 35

Assisted Solution

by:Nirmal Sharma
Nirmal Sharma earned 180 total points
ID: 13400031
See if this can help you: -
http://www.computing.net/dos/wwwboard/forum/14075.html

Thanks
0
 
LVL 96

Accepted Solution

by:
Lee W, MVP earned 195 total points
ID: 13400313
This has to be scripted.  there is no /s script for the ren/rename command.  BUT, the script is easy and simple - see below:

The following script will rename everything .asp to everything .html AND make a log of it in rename.log from the directory it's executed in.  It WON'T process the current directory.  For example, to process the IIS default web tree, execute the command in c:\inetpub\wwwroot (just remember it does not process c:\inetpub\wwwroot itself).
-------------------------
@echo off
for /f "tokens=1 delims=" %%a in ('dir /s /b /ad') do if exist "%%a\*.asp" ren "%%a\*.asp" *.html & echo ren "%%a\*.asp" *.html >> rename.log
--------------------------------------------------





With the same restrictions as the above script, this one just creates another batch file you can review and then execute.  The batch file it creates is called rename.cmd

--------------------------------------------------
@echo off
for /f "tokens=1 delims=" %%a in ('dir /s /b /ad') do if exist "%%a\*.asp" echo ren "%%a\*.asp" *.html >> rename.cmd
--------------------------------------------------
0
 
LVL 1

Author Comment

by:crchambers
ID: 13643558
I ended up just doing it the old-fashioned way.... manually. Thanks for everybody's input.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article (http://rdsrc.us/u3GP7A) first and run the tool TDSSKiller (http://rdsrc.us/GDBBs4) to get rid of the infection. Once done, and if the …
Step by step guide to Clean and Sort your windows registry! Introduction: Always remember: A Clean registry = Better performance = Save your invaluable time In this article we're going to clear our registry manually! Yes, manually! The e…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month8 days, 20 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question