1.

Solve : Rename parts of files?

Answer»

hello,
I've got a directory filled with many files (a mix of .CSVs and .MSGs) that have the number "1990" in them somewhere in the file NAME. I want to change that to "1980" in all instances.

My original, naïve attempt was: RENAME *1990*.* *1980*.*

But I did not get what I wanted or expected.
I would be grateful for any help.

Thank you,Launch this batch file in the folder and it will create `renfiles.bat.txt` for you to examine in Notepad and then rename to `.bat` and execute if you are happy with it.


Code: [Select]@echo off
dir /b /a-d |find /i /v "%~nx0" |find /i /v "repl.bat" |repl "(.*)1990(.*)" "REN \q$&\q \q$11980$2\q" ax >"renfiles.bat.txt"
The above uses a helper batch file called `repl.bat` - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat

Place `repl.bat` in the same folder as the batch file or in a folder that is on the path.

Thank you foxidrive.
Unfortunately, out IT group blocks dropbox, so I cannot retreive the helper batch file.
Is it possible to get the code for repl.bat and re-create it?
Quote from: one stupid guy on April 08, 2014, 09:22:37 AM

Thank you foxidrive.
Unfortunately, out IT group blocks dropbox, so I cannot retreive the helper batch file.
Is it possible to get the code for repl.bat and re-create it?
TXT file attached.

[recovering DISK space, attachment deleted by admin]Thank you so MUCH, Geek-9pm and foxidrive.
I was ABLE to use and alter the program as needed.

I very much appreciate your help.


Discussion

No Comment Found