Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
re-name huge ammount of files
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
greg32
Apprentice
Apprentice


Joined: 26 Mar 2003
Posts: 259
Location: Australia

PostPosted: Thu Jan 15, 2004 10:29 pm    Post subject: re-name huge ammount of files Reply with quote

Hi,
I have a lot of mp3 files (thousands). Some are names as per the songs, and most of them are named just with numbers (i.e. 1,2,3,4,02,03,04...). They are all over the place. I want to copy them into one directory, but because there are lots of 01's, and 1's and 02's... there will be a big head ache with the same files names. Is there a way that I can rename a large ammount of files in one go, and at the same time, tell the rename command to give them the name 1,2,3,4,5,6.... in sequence as it is doing it, so that they all end up in order, and only one file has the one number as it's name, so that I can store them in one directory??? I hope this makes sense.

regards Greg
Back to top
View user's profile Send private message
bmichaelsen
Veteran
Veteran


Joined: 17 Nov 2002
Posts: 1277
Location: Hamburg, Germany

PostPosted: Thu Jan 15, 2004 10:33 pm    Post subject: Reply with quote

You could do this with some bash magic. Or simply use the RenameSeq-Button in the gentoo-Filemanager (is in portage) ....
Back to top
View user's profile Send private message
David_Escott
l33t
l33t


Joined: 12 Jan 2003
Posts: 952
Location: Boston, MA

PostPosted: Thu Jan 15, 2004 10:36 pm    Post subject: Reply with quote

$count=0;
for dir in directory1 directory2 directory3 etc...
do
for f in ~/$dir/*.mp3
do
mv ~/$dir/$f ~/dest/$count.mp3;
count= $(( $count + 1 ));
done
done

I'm sure there are better ways to do this. But that would put you on the basic track. Also searching the forums for rename and mmv will bring up lots of stuff about those two programs.
Back to top
View user's profile Send private message
TheEternalVortex
Apprentice
Apprentice


Joined: 15 Oct 2002
Posts: 207
Location: San Jose, CA

PostPosted: Fri Jan 16, 2004 12:07 am    Post subject: Reply with quote

You could do this in perl. It would also be easy to rename based on ID3 tags or anything like that too.
_________________
-- Andy
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum