batch remove periods from files

I had a user that had a folder of files that had a lot of .’s in the names.  As an example:

They needed all of the .’s replaced with a space.  Here is the contents of the batch file that I created to fix the issue:

@echo off
 setlocal enableextensions disabledelayedexpansion

for %%a in (*) do (
 set "filename=%%~na"
 setlocal enabledelayedexpansion
 for %%f in ("!filename:.= !") do (
 ren "%%~fa" "%%~f%%~xa"

All the user has to do is copy the .bat file into the directory that has the problem files and then run the .bat file.

This is a slightly modified version of the script found at:

Leave a Reply

Your email address will not be published. Required fields are marked *