Jeff Abrahamson on 10 Sep 2005 13:05:23 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] batch renaming


On Fri, Sep 09, 2005 at 09:33:52AM -0400, Art Alexion wrote:
>   [30 lines, 135 words, 976 characters]  Top characters: _teanro\n
> 
> in dos if I wanted to rename a batch of files i a directory, I could do
> 
>     move (or rn) ??.txt 61??.txt
> 
> and it would rename all of the two character-named text files to prepend
> 61.  Bash won't let me do this as
> 
>     mv ??.txt 61??.txt
> 
> returns an error indicating that. when moving multiple files, the target
> must be a directory.  Is there a command that will let me do this?

In addition to using sh and rename, note that you can also use emacs'
dired feature (M-x dired or C-x d).  You would want the commands %m
(mark by regex) and then %R (rename by regex).  You can also do query
replace by regex (bound to Q), which is very nice for making sure
you're doing the right thing.

-- 
 Jeff

 Jeff Abrahamson  <http://www.purple.com/jeff/>    +1 215/837-2287
 GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug