Computing.Net > Forums > Programming > Batch remove %20 from filenames

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch remove %20 from filenames

Reply to Message Icon

Name: ovdp
Date: February 10, 2006 at 09:58:07 Pacific
OS: Win xp
CPU/Ram: centrino 1.7 / 1024 ram
Product: intel
Comment:

Hello,

I have a lot of files which countain %20 in their names. So I would like to remove %20. I have a Batch Dos script which remove spaces in filenames. Could you help me to adapt it? I would be very happy! Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: February 10, 2006 at 13:23:26 Pacific
Reply:

Hi
@echo off
setlocal EnableDelayedExpansion

rem Change path as required /s All files
dir /b /s | find "%%20" > Files.txt

for /f %%a in (Files.txt) do (
set FName=%%a
set FName=!FName:%%20=!
rem Tryed using Rename but did'nt work
rem must be something to do with the %
rem delimeter, so used copy then delete.
copy %%a !FName! > nul
del %%a > nul
)
echo Done!
setlocal


0

Response Number 2
Name: shahramsh
Date: February 17, 2006 at 17:24:58 Pacific
Reply:

howabout

@echo off
setlocal EnableDelayedExpansion
for /f "delims=" %%I in ('dir /b ^| find "%20"') do (
set var01=%%I
set var02=!var01:%%20=!
call :ren
)
:ren
ren %var01% %var02%


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch remove %20 from filenames

Remove quotes from user input string www.computing.net/answers/programming/remove-quotes-from-user-input-string/19410.html

Removing Numbers from Filename www.computing.net/answers/programming/removing-numbers-from-filename/20132.html

batch script to parse filenames www.computing.net/answers/programming/batch-script-to-parse-filenames/15286.html