Batch to apend Folder name to filenames

May 13, 2009 at 06:03:38
Specs: Windows Vista
Can anyone point me to a DOS batch that will append the folder name to all files within that directory:

ie: c:\12345 contains 60 files and I want the file names to read 1234511111.1, 1234511115.1, etc...

See More: Batch to apend Folder name to filenames

Report •

May 14, 2009 at 14:59:50
You should save this in a different folder, or change (*) to (.txt) or whatever you are renaming. If you do put this batch in the same folder ie c\12345 you can loose the pushd.

@echo off
pushd c:\12345
for %%a in (.) do set dir=%%~nxa
for %%a in (*) do call :name "%%~a"
goto :eof

set file=%~1
ren "%file%" "%dir%%file%"

Report •
Related Solutions

Ask Question