[Bf-funboard] Bf-funboard Digest, vol 44-3 renaming files
Campbell Barton
ideasman42 at gmail.com
Wed Apr 9 19:40:44 CEST 2008
On Wed, Apr 9, 2008 at 6:23 PM, Stephen Swaney <sswaney at centurytel.net> wrote:
> On Wed, Apr 09, 2008 at 01:20:57PM +0300, Toni Alatalo wrote:
> >
> > > Luckily for for final0001.dpx we used bash-fu to do the renaming for us.
> > >
> > > for i in final????.dpx; do j=`echo $i | sed 's/final/final0/g'`; mv
> > > "$i" "$j"; done
> > >
> > i also had to do the same during Orange, wrote an equivalent renaming
> > script in Python. was certainly nasty, so i guess it's a +1 from me.
>
> Linux (or at least opensuse) has a rename command that does
> rename from-pattern to-pattern file-mask.
>
> The above example would be
> rename final final0 final????.dpx
doubtless there are many renaming utlities, my point is we should not
have to use them, krename, gprename, and I have written some also, but
you shouldn't have to use them! :-)
for i in final????.dpx; do j=`echo $i | sed 's/final/final0/g'`; mv
"$i" "$j"; done
This works by getting every file with only 4 numbers and replacing the
prefix with a zero at the end. - Have had to use it twice today even.
More information about the Bf-funboard
mailing list