tags:

views:

44

answers:

2

Is there any example on DOS Batch - Find and Replace command for files?

I need to find all files with some exact name in a folder (and its sub folders) and replace tham all (one by one for ex) with another known file

A: 

Would something like "rename" do what you want? RENAME [drive:][path]filename1 filename2. REN [drive:][path]filename1 filename2.

  • Dew
Dew
No. I need to find all files with some exact name in a folder (and its sub folders) and replace tham all (one by one for ex) with another known file
Blender
A: 

for /f "tokens=*" %a in ('dir c:\myfolder\myoriginalfilename.txt /s /b') do ((del "%a") & copy MyNewFilename.txt "%~dpa")