Register
It is currently Wed Jul 23, 2014 5:54 am

Copy folders + included mp3's in order


All times are UTC - 6 hours


Post new topic Reply to topic  [ 9 posts ] 
Author Message
 PostPosted: Thu Mar 18, 2010 3:41 am   

Joined: Thu Mar 18, 2010 2:59 am
Posts: 5
Hi, I'm Linton

a little background: I've got a stupid mp3player, that doesn't order the media numerically/alphabetically but in the order the files are found on the disk... I've found out that most operating systems don't actually order these files either: they only display them this way to the user, this means that when I copy folders to my mp3player the order is all messed up... and I don't know "any" bash syntax, only cp,mv,rm,grep|apt-get etc
I've got all the folders I want copied to my player in one directory, and all the mp3s inside numbered 01,02..10,11..21,22..

Can you please make folders of the same names in the player, and then copy the mp3s 'in order' to the appropriate folders?


Top
 Profile  
 PostPosted: Thu Mar 18, 2010 6:35 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 532
Hi Linton,

a little output of ls on your directories, and what you want them to look like, would help us help you.
:)


Top
 Profile  
 PostPosted: Fri Mar 19, 2010 8:16 pm   

Joined: Thu Mar 18, 2010 2:59 am
Posts: 5
ok...
dr@x:~$ls Music/@96k/todo/
PROXL - The Hackers Mission
The Prodigy - Invaders Must Die
dr@x:~$ls Music/@96k/todo/PROXL\ -\ The\ Hackers\ Mission/
01. Remote Execute.mp3 04. Optical Fiber.mp3 07. Migration of Crows.mp3
02. Unreachable.mp3 05. Escaping.mp3 08. Waves Maker.mp3
03. Inside The Pyramid.mp3 06. Digital Tornado.mp3 09. Cosmic Music.mp3
dr@x:~$ls /media/disk/
MOVIE
MUSIC


Top
 Profile  
 PostPosted: Fri Mar 19, 2010 8:53 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 532
This is what you've got...

now, how should look like their copies into /media/disk/MUSIC (I guess)?


Top
 Profile  
 PostPosted: Fri Mar 19, 2010 9:44 pm   

Joined: Thu Mar 18, 2010 2:59 am
Posts: 5
um, exactly the same?


Top
 Profile  
 PostPosted: Fri Mar 19, 2010 10:52 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 532
then
Code:
cp -aR Music/@96k/todo/ /media/disk/MUSIC/
should do it, doesn't it?


Top
 Profile  
 PostPosted: Mon Mar 22, 2010 3:24 am   

Joined: Thu Mar 18, 2010 2:59 am
Posts: 5
look, I just explained that doing that copies them in a messed up order!

I need the command to {read the directory names} {make directories of the same names in the destination folder} {copy the mp3s to their respective directories IN THE ORDER 01,02,03...10,11,12...21,22,23...}


Top
 Profile  
 PostPosted: Mon Mar 22, 2010 6:31 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 532
but what have you tried so far ?
btw
Quote:
Can you please make folders of the same names in the player, and then copy the mp3s 'in order' to the appropriate folders?
Yes, I can.

I usually do so using a recursive function, that contains a `for' loop which tests wether `name' is a file, or a directory, and adapts its behaviour...


Top
 Profile  
 PostPosted: Mon Mar 22, 2010 6:59 pm   

Joined: Thu Mar 18, 2010 2:59 am
Posts: 5
yeah, whatever you do, don't freaking help me aye? just be a pain in the neck as much as possible..

..the answer is:
ls -t
(shows the problem)
cd MusicToMove/
find . -print0 | sort -zr | xargs -0 cp --parents
--target-directory=/media/disk/MUSIC/FoldersMoved
(fixes the problem)


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 7 guests


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 post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP