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

[SOLVED] Re: Script to rename files



Hi,

On Fri, 2005-06-03 at 10:19 +0200, Juan L. Pastor wrote:

> I need a script to rename several files to docXXX.txt where XXX is a
> number I can define, for example 054, and the following files will be
> renamed as 055, 056,... Can you help?

Thanks for all your answers.

I forgot to mention that the source files have very different names.
Anyway, thanks to other threads and your answers, I have managed to get
the right script (or at least the one that works for me :))

#!/bin/bash
OLDIFS=$IFS
IFS=$'\n'
Z=972
for i in *
do newname=`echo "doc$Z.txt"`
mv $i "$newname"
Z=$(($Z+1))
done
IFS=$OLDIFS

Juan

-- 
Please avoid sending me Word or PowerPoint attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html


		
______________________________________________ 
Renovamos el Correo Yahoo! 
Nuevos servicios, más seguridad 
http://correo.yahoo.es


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