1.

Solve : replace characters "_ " and " . " in file names to space with a batch file?

Answer»

Quote

just change "*.rar" to "*" for all files.

what about FILE name dear gh0std0g74? how can i replace windows media player in your script?

i mixed yours scriptes (Reno --gh0std0g74--devcom) and made a wonderful program but still i am not satisfied but i think i should search more and more to turn into a more experienced programmer
thanks again for your cooperation

and reno your program will always remove "." from files names even version exapmle nero v2.12
Quote from: mioo_sara on June 02, 2009, 07:30:07 AM
and reno your program will always remove "." from files names even version exapmle nero v2.12

because it only detect '_v'
try this, it will detect 'v[0-9]', i couldnt' find a way to hack a for loop to work with 'set &' trick. and findstr/o doesnt display the offset as intended, so this is the manual way.
Code: [Select]@echo off & setlocal

for /R %%a in (*.rar) do call:strip "%%a"
GOTO:eof

:strip
set app=%~n1&set ver=
set app=%app:v0=&set ver=v0%
set app=%app:v1=&set ver=v1%
set app=%app:v2=&set ver=v2%
set app=%app:v3=&set ver=v3%
set app=%app:v4=&set ver=v4%
set app=%app:v5=&set ver=v5%
set app=%app:v6=&set ver=v6%
set app=%app:v7=&set ver=v7%
set app=%app:v8=&set ver=v8%
set app=%app:v9=&set ver=v9%
set app=%app:.= %
set app=%app:_= %
set pad=%app%
echo Renaming App : %pad:~,25% Ver : %ver%
ren "%~1" "%app%%ver%%~x1"
thanks dear reno 100% done !!!
wonderful what a BEAUTIFUL algorithm !! thanks man
it can detect "_" and "." all over the file names and remains version and extention
just for a final request can you put folders and subfolders in your program?
it just now check and rename files
thanks
the following will rename files and folders that contain "v[0-9]" in its name. it wont work if name contains '=' sign.
Code: [Select]@echo off & setlocal

for /r /d %%a in (*) do call:strip "%%a"
for /r %%a in (*) do call:strip "%%a"
goto:eof

:strip
set app=%~n1&set ver=
set app=%app:v0=&set ver=v0%
set app=%app:v1=&set ver=v1%
set app=%app:v2=&set ver=v2%
set app=%app:v3=&set ver=v3%
set app=%app:v4=&set ver=v4%
set app=%app:v5=&set ver=v5%
set app=%app:v6=&set ver=v6%
set app=%app:v7=&set ver=v7%
set app=%app:v8=&set ver=v8%
set app=%app:v9=&set ver=v9%
set app=%app:.= %
set app=%app:_= %
if /i "%~nx1" neq "%app%%ver%%~x1" (
set pad=%app%
echo Renaming App : %pad:~,25% Ver : %ver% Ext : %~x1
ren "%~1" "%app%%ver%%~x1"
)
thanks dear RENO
folders and files are ok now thanks for your cooperation
have a nice and good day Hello I need some help,
I want to replace letter # with R in evry folder and every file.eg.4676867#565:4676867R565
please help me as soon as posible


Discussion

No Comment Found