generic renaming of files in ubumenu

Jul 9, 2007 at 1:08pm

generic renaming of files in ubumenu

Hello,

I am trying to find a a way to generically rename some sound-files (in
ubumenu) with the extensions .aif or aiff. Basically I need to trim the
extension (keeping the file-names) and add another user-defined string to
the end of the file-name.

I have come up with a solution (please see bellow) but I was wandering if
there is a more elegant and faster way of doing it without using java
script?

Many thanks in advance

Best
Peiman

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 548 106 48 196617 loadbang;
#P message 133 522 358 1966in 17 -o /go_batchfx.aif;
#P user ubumenu 103 112 379 196617 0 1 1 0;
#X setrgb 0 0 0 187 187 187 234 234 234 4 4 4 141 141 141 0 0 0;
#X add hello.aif;
#X add mysoundfile.aiff;
#X add go.aif;
#X add hi there.aif;
#X prefix_set 0 0 / 0;
#P objectname var1;
#P newex 242 285 51 196617 pack i 95;
#P message 193 286 39 196617 set 95;
#P newex 241 306 62 196617 prepend set;
#P newex 139 315 40 196617 append;
#P newex 193 263 49 196617 route 46;
#P newex 139 263 51 196617 zl ecils 1;
#B color 5;
#P newex 208 420 58 196617 prepend -o;
#P newex 123 468 62 196617 prepend set;
#P newex 189 352 35 196617 zl join;
#B color 5;
#P newex 157 215 120 196617 atoi;
#B color 5;
#P user textedit 420 223 539 243 98436 3 9 batchfx.aif;
#P newex 420 288 120 196617 atoi;
#B color 5;
#P newex 197 379 151 196617 itoa;
#B color 5;
#P newex 157 238 51 196617 zl ecils 4;
#B color 5;
#P newex 420 248 56 196617 route text;
#P connect 8 0 7 0;
#P connect 7 0 16 0;
#P connect 1 0 9 0;
#P connect 9 0 11 0;
#P connect 12 0 11 0;
#P connect 13 0 11 0;
#P connect 15 1 5 0;
#P connect 5 0 1 0;
#P connect 11 0 6 0;
#P connect 9 1 10 0;
#P connect 10 0 13 0;
#P connect 6 0 2 0;
#P connect 2 0 8 0;
#P connect 3 0 6 1;
#P connect 14 0 12 0;
#P connect 10 1 14 0;
#P connect 17 0 4 0;
#P connect 4 0 0 0;
#P connect 0 0 3 0;
#P window clipboard copycount 18;

#32806
Jul 9, 2007 at 2:30pm

Hey Peiman,

You could also do it with regexp, which may be less cryptic in the long
run (and certainly easier to expand upon)…

Owen

#P window setfont “Sans Serif” 10.;
#P window linecount 1;
#P newex 595 153 29 9109514 t b i;
#P newex 360 330 94 9109514 prepend substitute;
#P newex 471 253 27 9109514 t b s;
#P newex 360 253 27 9109514 t b s;
#P newex 471 285 91 9109514 sprintf %%1%s.aif;
#P newex 360 289 100 9109514 sprintf %%1%s%%2;
#P newex 518 68 29 9109514 t b 0;
#P newex 518 34 53 9109514 loadbang;
#P comment 610 127 100 9109514 Force ‘.aif’;
#P user radiogroup 595 112 19 32;
#X size 2;
#X offset 16;
#X inactive 0;
#X itemtype 0;
#X flagmode 0;
#X set 0;
#X done;
#P user gswitch2 396 210 39 32 0 0;
#P window setfont “Sans Serif” 9.;
#P user textedit 453 112 572 132 65540 139 9 __batchtest;
#P newex 453 153 56 9109513 route text;
#P window setfont “Sans Serif” 10.;
#P message 241 436 247 9109514 /go__batchtest.aif;
#P window setfont “Sans Serif” 9.;
#P user ubumenu 57 114 379 9109513 0 1 1 0;
#X setrgb 0 0 0 187 187 187 234 234 234 4 4 4 141 141 141 0 0 0;
#X add hello.aif;
#X add mysoundfile.aiff;
#X add go.aif;
#X add hi there.aif;
#X prefix_set 0 0 / 0;
#P objectname var1;
#P window setfont “Sans Serif” 10.;
#P newex 241 404 63 9109514 prepend set;
#P newex 241 372 129 9109514 regexp (.*)(.aiff|.aif);
#P window linecount 3;
#P comment 376 370 166 9109514 .aiff needs to be before .aif to count as
a distinct case , and be correctly preserved. Brittle;
#P window linecount 1;
#P comment 610 112 100 9109514 Preserve Extension;
#P fasten 18 0 7 0 600 181 584 181 584 108 458 108;
#P connect 16 0 14 0;
#P connect 16 1 14 2;
#P connect 14 0 17 0;
#P connect 18 1 8 0;
#P connect 9 0 18 0;
#P connect 17 0 2 0;
#P connect 15 0 13 0;
#P connect 15 1 13 2;
#P connect 13 0 17 0;
#P connect 2 0 3 0;
#P connect 8 1 16 0;
#P connect 8 0 15 0;
#P connect 6 0 8 1;
#P connect 12 0 7 0;
#P connect 12 1 9 0;
#P connect 11 0 12 0;
#P connect 7 0 6 0;
#P connect 3 0 5 0;
#P connect 4 1 2 0;
#P window clipboard copycount 19;

peiman khosravi wrote:
> Hello,
>
> I am trying to find a a way to generically rename some sound-files (in
> ubumenu) with the extensions .aif or aiff. Basically I need to trim the
> extension (keeping the file-names) and add another user-defined string to
> the end of the file-name.
>
> I have come up with a solution (please see bellow) but I was wandering if
> there is a more elegant and faster way of doing it without using java
> script?
>
> Many thanks in advance
>
> Best
> Peiman
>

#108488
Jul 9, 2007 at 3:23pm

Thanks very much Owen,

This looks way better than what I had ;-)

Peiman

On 09/07/07, Owen Green wrote:
>
> Hey Peiman,
>
> You could also do it with regexp, which may be less cryptic in the long
> run (and certainly easier to expand upon)…
>
> Owen
>
> #P window setfont “Sans Serif” 10.;
> #P window linecount 1;
> #P newex 595 153 29 9109514 t b i;
> #P newex 360 330 94 9109514 prepend substitute;
> #P newex 471 253 27 9109514 t b s;
> #P newex 360 253 27 9109514 t b s;
> #P newex 471 285 91 9109514 sprintf %%1%s.aif;
> #P newex 360 289 100 9109514 sprintf %%1%s%%2;
> #P newex 518 68 29 9109514 t b 0;
> #P newex 518 34 53 9109514 loadbang;
> #P comment 610 127 100 9109514 Force ‘.aif’;
> #P user radiogroup 595 112 19 32;
> #X size 2;
> #X offset 16;
> #X inactive 0;
> #X itemtype 0;
> #X flagmode 0;
> #X set 0;
> #X done;
> #P user gswitch2 396 210 39 32 0 0;
> #P window setfont “Sans Serif” 9.;
> #P user textedit 453 112 572 132 65540 139 9 __batchtest;
> #P newex 453 153 56 9109513 route text;
> #P window setfont “Sans Serif” 10.;
> #P message 241 436 247 9109514 /go__batchtest.aif;
> #P window setfont “Sans Serif” 9.;
> #P user ubumenu 57 114 379 9109513 0 1 1 0;
> #X setrgb 0 0 0 187 187 187 234 234 234 4 4 4 141 141 141 0 0 0;
> #X add hello.aif;
> #X add mysoundfile.aiff;
> #X add go.aif;
> #X add hi there.aif;
> #X prefix_set 0 0 / 0;
> #P objectname var1;
> #P window setfont “Sans Serif” 10.;
> #P newex 241 404 63 9109514 prepend set;
> #P newex 241 372 129 9109514 regexp (.*)(.aiff|.aif);
> #P window linecount 3;
> #P comment 376 370 166 9109514 .aiff needs to be before .aif to count as
> a distinct case , and be correctly preserved. Brittle;
> #P window linecount 1;
> #P comment 610 112 100 9109514 Preserve Extension;
> #P fasten 18 0 7 0 600 181 584 181 584 108 458 108;
> #P connect 16 0 14 0;
> #P connect 16 1 14 2;
> #P connect 14 0 17 0;
> #P connect 18 1 8 0;
> #P connect 9 0 18 0;
> #P connect 17 0 2 0;
> #P connect 15 0 13 0;
> #P connect 15 1 13 2;
> #P connect 13 0 17 0;
> #P connect 2 0 3 0;
> #P connect 8 1 16 0;
> #P connect 8 0 15 0;
> #P connect 6 0 8 1;
> #P connect 12 0 7 0;
> #P connect 12 1 9 0;
> #P connect 11 0 12 0;
> #P connect 7 0 6 0;
> #P connect 3 0 5 0;
> #P connect 4 1 2 0;
> #P window clipboard copycount 19;
>
>
> peiman khosravi wrote:
> > Hello,
> >
> > I am trying to find a a way to generically rename some sound-files (in
> > ubumenu) with the extensions .aif or aiff. Basically I need to trim the
> > extension (keeping the file-names) and add another user-defined string
> to
> > the end of the file-name.
> >
> > I have come up with a solution (please see bellow) but I was wandering
> if
> > there is a more elegant and faster way of doing it without using java
> > script?
> >
> > Many thanks in advance
> >
> > Best
> > Peiman
> >
>

#108489

You must be logged in to reply to this topic.