Renaming files in a folder

Hewlett-packard / Presario v2000 (ev889pa#a...
August 9, 2010 at 19:06:49
Specs: Microsoft Windows XP Home Edition, 1.695 GHz / 1270 MB
The objective is to rename all the files in a directory that contain "%20" in their filenames so that this string will not be present in the filenames after renaming.
Basically, a given string present in the filename has to be removed for all the files in a folder. It is not necessary that all the files should have this string in their filenames. Also, a file may contain multiple occurrances of this string in their filenames.
thanks in advance
viswanthan m

See More: Renaming files in a folder

Report •

#1
August 12, 2010 at 07:19:16
No takers, eh?
setlocal EnableDelayedExpansion
for %%a in (*%%20*) do @(
  set _n=%%a
  set _n=!_n:%%20= !
  ren "%%a" "!_n!"
)


Report •

#2
August 12, 2010 at 18:28:25
Dear Friend,
When your code is converted into a .vbs file and run, the following error occurs:
Invalid Character (line2 chr5)
Code:800A0408
Source: Microsoft VBScript compilation error.
request to set right the error
viswam

Report •

#3
August 12, 2010 at 19:27:59
You are supposed to save and run it as a batch file.

Report •

Related Solutions

#4
August 12, 2010 at 20:01:01
Dear Friend
Thanks a lot. A new window of learning has been opened by you. Everyday is a day for learning and again, thanks a lot.
viswam

Report •

Ask Question