1.

Solve : delete some char on file name?

Answer»

Hello

some users using DONT accepted char on file names...

example :
Adam 11.01.2014.xls  or
Sunday, (11.01.2014).xls  or
London 11,01,2014.xls  or
Nuni.......05.05,2014......xls  or
Jane, 15,may,2014....sales!.doc


must be smilar file name
Adam 11-01-2014.xls

i will delete some chars, some chars will change new chars
i have rename program. but dont understand file-name or file-ext..  when i wanna change (.,!) smilar char, effecting with file-ext

what i wanna do on file names?
a) delete multi poins on files names with one point after i will change with [-]
b) change [, ]  with [ ]
c) delete [( ) !] and smilar chars on file-names
d) change [< > ] with [-]
e change [-- or more -] with [-] ones

but.. i must limit file-ext with :
[xls, xlsx, doc, docx, TXT, PDF, log, dat, ....]

time by time i can add new parameters

could you help me ?

thanksIt is hard to understand what your want to do.
Where did the files come from?
How many file do you  w ant to change?
hello

daily files on office
i change file names before backup
some days 10, some days +100 files changing with order

using fast file renamer program. but that program very simple. dont understand file-name and file-ext type

if possible, will be good before backup

thx
Test this: < and > are not legal in a filename so I ignored that.

Some lines are repeated to cater for MULTIPLE repeating . and - characters
It only shows the command on the screen, so remove the `echo` to make it work.

Code: [Select]echo off
for /f "DELIMS=" %%a in ('dir *.xls *.xlsx *.doc *.docx *.txt *.pdf *.log *.dat /a:-d /o:n /b') do call :next "%%a"
pause
GOTO:EOF
:next
set "newname=%~nx1"

set "newname=%newname:,= %"
set "newname=%newname:)=%"
set "newname=%newname:(=%"
set "newname=%newname:!=%"
set "newname=%newname:..=.%"
set "newname=%newname:..=.%"
set "newname=%newname:..=.%"
set "newname=%newname:..=.%"
set "newname=%newname:..=.%"
set "newname=%newname:--=-%"
set "newname=%newname:--=-%"
set "newname=%newname:--=-%"
set "newname=%newname:--=-%"
set "newname=%newname:--=-%"

echo ren %1 "%newname%

thank you very much

i will try tomorrow...

you are and your excellent codes.....   

thx



Discussion

No Comment Found