Help-how to manipulate filenames in DOS

Microsoft Upg-vc msdos 6.22
November 16, 2009 at 15:27:17
Specs: Windows XP
Someone please help me how to change all the files in my directory from:
test_01.log
test_02.log
test_03.log
TO:
test.01
test.02
test.03

See More: Help-how to manipulate filenames in DOS

Report •


#1
November 16, 2009 at 17:12:12
What difference is there between an underscore or period in a file name?

Home Page http://ewen.uuuq.com/


Report •

#2
November 16, 2009 at 17:42:11
Do not ignore the extension (.log) of the filename. If you do no program will be able to open it because there is nothing to associate a filename without an extension.

i_Xp/Vista/W7User


Report •

#3
November 16, 2009 at 18:00:42
Forget about DOS. In XP, try this:

=============================
@echo off & setLocal EnableDELAYedExpansion

for /f "tokens=* delims= " %%a in ('dir/b/a-d test_*.log') do (
set s=%%~Na
set n=!s:~0,4!
set e=!s:~-2!
ren %%a !n!.!e!
)


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
November 16, 2009 at 19:53:31
If we really are talking about MS-DOS then the file extensions would be irrelevant as DOS took little notice of file extensions. The only ones that really mattered were .com and .exe. File extension were something that Microsoft introduced in the very early days with a view to future implementation but did very little. I t wasn't until Windows 95 came out that files extensions became important.

If we are really talking about Windows XP, then file extension do matter.

The underscore in a file name is part of the name, no different than abc. The period is the separator between the file name and the extension.

Stuart


Report •


Ask Question