Computing.Net > Forums > Programming > Batch File to replace '.' With '_'

Batch File to replace '.' With '_'

Reply to Message Icon

Original Message
Name: seabass
Date: May 4, 2007 at 07:49:56 Pacific
Subject: Batch File to replace '.' With '_'
OS: Windows XP SP2
CPU/Ram: P4 2.8 1gb
Model/Manufacturer: Self Built
Comment:

I need to have a batch file that replaces all '.' except for '.csv' in file name to '_' for all files in a folder. Any help would be greatly appreciated


Report Offensive Message For Removal

Response Number 1
Name: IVO
Date: May 4, 2007 at 08:59:54 Pacific
Subject: Batch File to replace '.' With '_'
Reply: (edit)

Run the following batch in your folder where the .csv files are stored

@Echo Off
SetLocal EnableDelayedExpansion
For %%J in (*.csv) Do (
Set File=%%~nJ
Ren "%%J" "File=!File:.=_!.csv")


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch File to replace '.' With '_'

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software