renaming temp internet files at once

December 9, 2009 at 02:30:58
Specs: Windows Vista
Hi All,

when I copy the temp internet files to another location, it adds [1] just before the . e.g. back[1].gif. I want you guys to help me write a batch file which can remove this [1] from all the files just by double clicking that bat file or let me know if you have got any other altenative,

Thanks


See More: renaming temp internet files at once

Report •


#1
December 9, 2009 at 02:50:09
Does it effect just back.gif or many or all files?


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

M2


Report •

#2
December 9, 2009 at 03:02:07
it affects all files, actually sometime I need 50 or 100 files from temp internet files which include gifs, css, js.

when I copy them, there is a [1] after the file name just before the dot.

at the moment what i do is create a bat file say 1.bat

i type a commad dir>file.txt

in which i get all the names of the files in the directory, then open this file.txt in excel, remove the odd bits

to cut the story short, i make it like the following
ren back[1].gif back gif
ren styles[1].css styles.css
.
.
.
it only takes me two minutes to do all this, I just want someone to help me write a script in that bat file

which can simply search for any filename with [1] and just simply remove that [1] from all the file names


Report •

#3
December 9, 2009 at 03:19:02
Tailor the pushd line to your path.

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

pushd d:\

for /f "tokens=* delims= " %%a in ('dir/b/a-d ^| find "[1]"') do (
set S=%%a
set S=!S:[1].=.!
ren "%%a" "!S!"
)


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

M2


Report •

Related Solutions

#4
December 9, 2009 at 03:49:30
You are a STAR ************************

It worked without editing anything, I just tried copying some files into a new folder and made a batch file with the code you sent, just ran it and it removed the [1] from all the files.

Thanks for your help.


Report •


Ask Question