Hi
I have a number of files in a folder like below:
200002 - [20130708] - Test1
258258 - [20130907] - Test2
Is it possible to remove the [ and ] so i would be left with:
200002 - 20130708 - Test1
258258 - 20130907 - Test2
Many thanks
Paul
Remove [] from file name
Moderator: DosItHelp
Re: Remove [] from file name
This could help if the files are in the current directory:
penpen
Code: Select all
@echo off
setlocal enableDelayedExpansion
for %%a in (*) do (
set FILE=%%~a
set FILE=!FILE:[=!
set FILE=!FILE:]=!
echo rename "%%~a" "!FILE!"
)
endlocal
goto:eof
penpen
Re: Remove [] from file name
If you use ! characters in your filenames, then ask for further help.
Re: Remove [] from file name
Works perfectly for [ and ].
Would i be able to adjust this to replace
- page
with
_page
Many thanks
Paul
Would i be able to adjust this to replace
- page
with
_page
Many thanks
Paul
Re: Remove [] from file name
aveit wrote:Works perfectly for [ and ].
Would i be able to adjust this to replace
- page
with
_page
Many thanks
Paul
Add this to the code.
Code: Select all
set FILE=!FILE:- page=_page!