Rename all files of a type in sub folders

May 14, 2011 at 02:40:25
Specs: Windows XP
Hello. I'm looking for a batch code which renames all files of a type in sub folders, depending on the sub folders name. An example:

\Folder1\unnamed.txt -> \Folder1\Folder1.txt
\Folder2\unnamed.txt -> \Folder2\Folder2.txt


There is just one file each folder.
Thanx


See More: Rename all files of a type in sub folders

Report •

#1
May 14, 2011 at 18:46:31
for /r %%a in (unnamed.txt) do for %%b in ("%%a\..") do ren "%%a" "%%~NXb%%~Xa"

How To Ask Questions The Smart Way


Report •

#2
May 15, 2011 at 00:18:26
Hi R2,

pretty smooth


=====================================
Life is too important to be taken seriously.

M2


Report •

#3
May 15, 2011 at 12:55:59
Thanks. I was just going to link to a previous thread where I answered the same question, but I couldn't find it.

How To Ask Questions The Smart Way


Report •
Related Solutions


Ask Question