Thanks Allan,

I'll try this.

We reckon it would also be possible to do it with perl, but since I haven't
yet found it in any of the online perl script libraries I've looked in,
and haven't yet got past chapter one of Learning Perl (or "The Llama Book"
as I believe you're meant to call it)....

Tom.

-- Original Message --
>>
>> > ----- Original Message -----
>> > From: <[EMAIL PROTECTED]>
>> > To: <[EMAIL PROTECTED]>
>> > Sent: Wednesday, January 23, 2002 5:31 PM
>> > Subject: [scottish] Batch renaming of files
>> >
>> >
>> > Is there a simple way of renaming a set of files? I want to merge two
>> > directories
>> > containing image files and change the names to something systematic
like
>> > 01.jpg, 02.jpg, etc.
>> >
>> > When I tried using mv, I get a message saying
>> > "When moving multiple files, last parameter must be a directory"
>> >
>> > Presumably someone's already written a script to do this: any suggestions
>> > where I can find one (which will run on Mandrake 8.0)?
>
>Hi,
>
>This all looks very nice - nothing like a random mixture of as many
>types of quotes and other obscure symbols on one line to put the newbies
>off.
>
>For the people who can't find the ` key on their keyboard, you could
>perhaps check out a simple little command/program called "mmv" (multiple
>move) which should do the job. It may come as standard with some
>distros.
>
>However, I don't think this command (or the solutions people were
>quoting) actually answer the question originally posed.
>
>I think the question is we have a directoy structure like
>
>       mydirectory/pictureofme.jpg
>       mydirectory/otherpictureofme.jpg
>       hisdirectory/wow.jpg
>       hisdirectory/lookatthis.jpg
>
>And want to end up with:
>
>       newdir/1.jpg
>       newdir/2.jpg
>       newdir/3.jpg
>       newdir/4.jpg
>
>In answer to the original question, I don't really know of a _simple_
>way to do this.
>
>You could try:
>
># !/bin/bash
>
>mkdir newdir
>a=1
>for i in mydirectory/* hisdirectory/*; do
>       cp "$i" newdir/$a.jpg
>       let a=$a+1
>done
>
>Look! I managed to do it on more than one line, I must be great since
>everyone else only seems to be able to write a single line of code :).
>
>Thanks,
>
>Allan
>--
>Don't argue with a fool. The spectators can't tell the difference.
>--------------------------------------------------------------------
>http://www.lug.org.uk                   http://www.linuxportal.co.uk
>http://www.linuxjob.co.uk               http://www.linuxshop.co.uk
>--------------------------------------------------------------------
>



--------------------------------------------------------------------
http://www.lug.org.uk                   http://www.linuxportal.co.uk
http://www.linuxjob.co.uk               http://www.linuxshop.co.uk
--------------------------------------------------------------------

Reply via email to