hamlet_X said:
Hi,
I would like to do a "for in do rename" script with XP. I want to rename
files all with the same name. The digits in the end of the filename depend
on how many files are in the folder like from myfile001.jpg to myfile
218.jpg or somefile01 up to somefile77. I hope I've explained it ok. My
English is not this good.
The other thing is the "devcon remove [ID]". This works fine but when I
remove my Memory Stick device it alway has to be reinstalled afterwards.
When I remove by hand with the mouse not wth a command line it works fine.
There is never a reinstall process when I put in a new MemoryStick.
regards
Herbert
- - - - - - - - - - begin screen capture - - - - - - - - - -
<Win2000> C:\CMD>demo\rename87 c:\cmd\txt\*.txt
ren "DUMPVARS.TXT" "DUMPVARS01.TXT"
ren "TIMESRUN.TXT" "TIMESRUN02.TXT"
ren "GETINPUT.TXT" "GETINPUT03.TXT"
ren "MSGBOX1.TXT" "MSGBOX104.TXT"
ren "rename77.txt" "rename7705.txt"
ren "MVSPKG01.TXT" "MVSPKG0106.TXT"
ren "MVSPKG02.TXT" "MVSPKG0207.TXT"
ren "upper.txt" "upper08.txt"
ren "LASTPART.TXT" "LASTPART09.TXT"
ren "getipmsg.txt" "getipmsg10.txt"
ren "DATECALC.TXT" "DATECALC11.TXT"
ren "htmlinpt.txt" "htmlinpt12.txt"
ren "DOHTML.TXT" "DOHTML13.TXT"
ren "CLSPRICE.TXT" "CLSPRICE14.TXT"
ren "SPLITUP.TXT" "SPLITUP15.TXT"
ren "LOKCRACK.TXT" "LOKCRACK16.TXT"
ren "XSUBSTR.TXT" "XSUBSTR17.TXT"
ren "daysago.txt" "daysago18.txt"
ren "ZEROTEST.TXT" "ZEROTEST19.TXT"
ren "SENDCRYP.TXT" "SENDCRYP20.TXT"
ren "this is a longname.txt" "this is a longname21.txt"
ren "calctime.txt" "calctime22.txt"
ren "zfindall.txt" "zfindall23.txt"
ren "~temp.txt" "~temp24.txt"
ren "saveme01.txt" "saveme0125.txt"
ren "~~temp.txt" "~~temp26.txt"
ren "dirsizes.txt" "dirsizes27.txt"
ren "splitfile.txt" "splitfile28.txt"
ren "filemov1.txt" "filemov129.txt"
ren "insertfield.txt" "insertfield30.txt"
ren "rsoon.txt" "rsoon31.txt"
ren "jobschedulers.txt" "jobschedulers32.txt"
ren "dirinfo.txt" "dirinfo33.txt"
ren "Stderr and Stdout to file.txt" "Stderr and Stdout to file34.txt"
ren "deloldsubs.txt" "deloldsubs35.txt"
ren "tail.txt" "tail36.txt"
ren "NTUrls.txt" "NTUrls37.txt"
ren "Clay Calvert Set.txt" "Clay Calvert Set38.txt"
ren "dosurls.txt" "dosurls39.txt"
ren "cmdlinetricks.txt" "cmdlinetricks40.txt"
ren "NTFS vs FAT File Systems.txt" "NTFS vs FAT File Systems41.txt"
<Win2000> C:\CMD>rlist c:\cmd\demo\rename87.cmd
=====begin c:\cmd\demo\rename87.cmd ====================
01. @echo off
02. setlocal
03. set filespec=%1
04. pushd %~dp1
05. set ctr=100
06. for /f "tokens=*" %%a in (
07. 'dir /b %filespec%'
08. ) do call :rename "%%a"
09. popd
10. goto :EOF
11. :rename
12. set /a ctr+=1
13. echo ren %* "%~n1%ctr:~1%%~x1"
14. goto :EOF
=====end c:\cmd\demo\rename87.cmd ====================
- - - - - - - - - - end screen capture - - - - - - - - - -
If the preceding does what you intend, than delete the word
'echo' from line 13 to actually rename the files.
Sorry, can't help with the Memory Stick question.