Hello,
I have multiple xml file in folder, which are response files received after processing them from our central office.
File name: Exec_19112013_1.XML.1.19112013.PASS
To remove the trailing .1.19112013.PASS after .XML
Remove the trailing from filename
Moderator: DosItHelp
Re: Remove the trailing from filename
And what happens if more than one file has Exec_19112013_1.XML as the beginning of the file name?
Regardless of that this would work if that will never happen.
Regardless of that this would work if that will never happen.
Code: Select all
@echo off
for %%G in (*.XML.*) do (
for /f "tokens=1,2 delims=." %%I in ("%%~G") do echo rename "%%~G" "%%~I.%%~J"
)
Re: Remove the trailing from filename
Squashman wrote:And what happens if more than one file has Exec_19112013_1.XML as the beginning of the file name?
The files are in sequential order. i.e. Exec_19112013_2.XML, xxx.3.XML
Thanks
Re: Remove the trailing from filename
Code: Select all
@echo off
for %%G in (*.XML.*) do (
for /f "tokens=1,2 delims=." %%I in ("%%~G") do echo rename "%%~G" "%%~I.%%~J"
)
Sorry, this does not remove the trailings from the file name.
Re: Remove the trailing from filename
Which means you don't know how the code works.
Remove the echo command in front of the rename command.
Most of us will put the echo in the code as a precautionary measure so you can see how it will be renamed before you actually want to rename them.
Remove the echo command in front of the rename command.
Most of us will put the echo in the code as a precautionary measure so you can see how it will be renamed before you actually want to rename them.
Re: Remove the trailing from filename
Hi,
Thanks Squashman.
Fantastic.
Thanks Squashman.
Fantastic.