[TriLUG] File renaming question
Matthew Opoka
matthew at opoka.name
Mon Dec 3 12:18:06 EST 2007
Mike,
You can set the paths to whatever you would like.
#!/bin/bash
x=0
STARTPATH=`pwd`/old
NEWPATH=`pwd`/new
for i in `ls $STARTPATH/*`
do
mv $i $NEWPATH/file$x
x=$((x+1))
done
----- Original Message ----
From: Mike Norwood <norwoodm at embarqmail.com>
To: trilug at trilug.org
Sent: Monday, December 3, 2007 11:38:49 AM
Subject: [TriLUG] File renaming question
Hello,
I think this should be really easy, but am growing dumber as I age. I
need to be able to take an undetermined number of files, could be 1 or 2,
could be 30 and move them to another directory as file1, file2, file3,
etc. The names in the first directory could apparently be anything,
and I am not concerned with the order they are renamed, just as long as 20
files comes out as file1 through file20. Please let me know if this
question is confusing, and I can try to give more details.
Thanks in advance for any help.
Mike Norwood
--
TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
TriLUG Organizational FAQ : http://trilug.org/faq/
TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
More information about the TriLUG
mailing list