[Israel.pm] multi move script

Oron Peled oron at actcom.co.il
Sun Aug 22 14:10:36 PDT 2004


On Sunday 22 August 2004 23:43, Kfir Lavi wrote:
> Mikhael Goikhman wrote:
> > On 22 Aug 2004 20:12:28 +0300, Shlomi Bakish wrote:
> > 
> >>Does anyone have or know of a script that enables doing mv with 
> >>wildcards  in unix (similar to dos move) ?
> >>
> >>mv    try_*.txt    work_*.txt

Believe me, you don't really want the limited DOS behaviour:
  - How does DOS respons to?
	REN *foo*.txt *bar*.txt
  - Try on Linux/Unix something like:
	ls /*/l*/*.s[ol]*
    and you'll get some hints for the power of shell wildcards.

> > Execute:
> > 
> >   rename try work try_*.txt
> > 
> It didn't work for me, but this does:
> rename 's/try/work/' try_*.txt

The truth is that there is no "official" rename in Unix/Linux,
so some people invented their own. Shlomi refered to some version
that exist on my system as well (don't know its origin).

You seem to have something similar to the "rename" script I
usually show at perl beginners course. It basically "eval" the
expression for each argument (the file names) and so is much
more powerfull. Examples:
	rename 'tr/A-Z/a-z/' *.doc *.DOC
	rename 's/$/.old/ if -M > 30' *

-- 
Oron Peled                             Voice/Fax: +972-4-8228492
oron at actcom.co.il                  http://www.actcom.co.il/~oron
ICQ UIN: 16527398

    .--.
   |o_o |
   |:_/ |
  //   \ \
 (|     | )
/'\_   _/`\
\___)=(___/



More information about the Perl mailing list