[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: renaming files



Reply to note from "Morris Krok"  Thu, 11 Dec
2003 20:16:27 +0200

> Renall does enable one to change the names of the files
> sequentially, however, after completing the name changing, it
> changes the default directory (xy4) to he name of the directory
> containing those files. ... I imagine that it will be easy to fix
> this minor glitch.

That was deliberate. My way of suggesting that you ChDir to the
directory containing the files to be renamed *before* running the
program, and that you scrutinize the the filenames in that directory
very closely afterwards -- because it's only a matter of time before
a routine like this produces unexpected results, whether due to user
error, or the intermittent bug that causes  to point to the
root directory instead of the directory path, or whatever.

In fact, as I think of it, that pesky bug in  has to be
worked around. Throw out yesterday's code, please, and use the
revision below. And well, Morris, since this routine belongs to
you, the current path is restored on EXit. As you like it.

XPLeNCODE v2.0
b-gin [UNTITLED]
{{;5renall}} REName all files in DIRectory display [CLD 12/11
/03][cr|lf]{002};*;    Use with care (and at your own ris
k)![cr|lf][XH_]{<}IF{<}VA$WS{>}<2!{<}VA|50{>}<1{>}{<}SV01,[cr
|lf]RENALL.PM [CLD rev. 12/11/03][cr|lf][cr|lf]Usage:[cr|lf]W
ith DIRectory display in current window:[cr|lf] RENALL newna
me[.ext][cr|lf][cr|lf]Operation:[cr|lf]After confirm
ation, RENames each listed file to newname1.ext, newname2.ext
, etc.[cr|lf][cr|lf]{>}[JM_]2.ShowSG01[Q2_]{<}EX{>}{<}EI{>};*
;[cr|lf][BX_]es 1[Q2_]{<}SX01,@upr({<}IS50{>}){>};*;[cr|lf]{<
}SX02,{<}VA$PA{>}{>}{<}SX02,"[BX_]"+{<}VA@02:1{>}+":[Q2_][BX_
]cd "+{<}IS02{>}+"[Q2_]"{>};*;[cr|lf]{<}SX03,{<}VA$DP{>}{>}{<
}SX50,{<}IS03{>}{>}[JM_]2.GetPath[Q2_]{<}SX04,{<}VA@03:1{>}{>
}[BX_]{<}PV04{>}:[Q2_][BX_]cd {<}PV50{>}[Q2_][BX_]dir/fi {<}P
V03{>}[Q2_];*;[cr|lf]{<}SV03,{>}{<}IF{<}IS01{>}{240}"."{>}{<}
SX03,{<}VA@01.2{>}{>}{<}SX01,{<}VA@01.1{>}{>}{<}EI{>};*;[cr|l
f]{<}SX04,0{>}{<}SV05,\{>}{<}SU06,{<}LBa{>}{<}IF{<}IS07{>}{24
0}"\"{>}{<}XS07,05,08,,08{>}{<}SX07,{<}IS08{>}{>}{<}GLa{>}{<}
EI{>}{>}{<}LBb{>}{<}SX07,{<}VA$DR{>}{>}{<}GT06{>}[BX_]exist {
<}PV07{>}[Q2_]{<}IF@not({<}ER{>}){>}{<}SX04,{<}PV04{>}+1{>}{<
}SX08,"REName "+{<}IS07{>}+" to "+{<}IS01{>}+{<}IS04{>}{>}{<}
IF{<}VA|03{>}>0{>}{<}SX08,{<}IS08{>}+"."+{<}IS03{>}{>}{<}EI{>
}{<}SX08,{<}IS08{>}+"? y|N|Esc"{>}{<}PR|@08{>}{<}SX08,{<}RK{
>}{>}{<}IF{<}VA$KC{>}<2{>}{<}SV01,Quit{>}{<}LBc{>}{<}PV02{>}{
<}PR@01{>}{<}EX{>}{<}EI{>};*;[cr|lf]{<}IF{<}VA$KC{>}==21{>}[B
X_]ren {<}PV07{>} {<}PV01{>}{<}PV04{>}.{<}PV03{>}[Q2_];*;[cr|
lf]{<}IF{<}ER{>}{>}{<}SV50,{>}[JM_]2.HIDE:02[Q2_][JM_]2.Errco
de[Q2_][JM_]2.UNHIDE[Q2_]{<}SX01,{<}IS50{>}{>}{<}GLc{>}{<}EI{
>}{<}EI{>};*;[cr|lf][LD_]{<}GLb{>}{<}
EI{>}[BX_]dir/fi {<}PV01{>}*{<}IF{<}VA|03{>}>0{>}.{<}PV03{>}{
<}EI{>}[Q2_]{<}SV01,Done{>}{<}GLc{>}{002}[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx