Chris Marget on 9 Sep 2005 13:37:06 -0000


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

Re: [PLUG] batch renaming


On Fri, 9 Sep 2005, Art Alexion wrote:

> 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?

for file in ??.txt
do
  mv $file 61$file
done

that will prepend '61' onto every filename.  is that what you're trying
to do?

/chris

___________________________________________________________________________
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