LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 12-20-2009, 07:12 AM   #1
Person_1873
Member
 
Registered: Sep 2007
Location: Australia
Distribution: Arch Linux
Posts: 489

Rep: Reputation: 39
move large amounts of music within a filestructure


hey,
i have a car stereo that reads a USB drive with all my music on it, however to sort through the music it uses a method of finding folders containing music, then displaying them all in a list.

i find this interface annoying because in order to sort the music by artist i have to go and manually move it out of the album folders by hand, this takes a long time for 11+ GB of music so i was trying to use the linux CLI to quicken the process.

my thoughts were to use a command like this

Code:
mv /media/usb/music/*/*/* /media/usb/music/*/
but for some reason this moves all my music into the last folder alphabetically in my drive, could someone help me to make this all work?

the music is all pre-arranged like this /media/usb/music/artist/album/song
 
Old 12-20-2009, 10:14 AM   #2
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 671

Rep: Reputation: 94
Quote:
Originally Posted by Person_1873 View Post
Code:
mv /media/usb/music/*/*/* /media/usb/music/*/
you got the expected outcome of that command line.



Code:
for $i in { ls -d /media/usb/music/* } do mv /media/usb/music/$1/*/* /media/usb/music/$1/ done
not tested,it should be /media/usb/music/artist/song after that.
 
Old 12-21-2009, 06:04 AM   #3
Person_1873
Member
 
Registered: Sep 2007
Location: Australia
Distribution: Arch Linux
Posts: 489

Original Poster
Rep: Reputation: 39
hey, could you please break that down for me and explain what each part does and how it works?
 
Old 12-21-2009, 07:26 AM   #4
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 671

Rep: Reputation: 94
Quote:
Originally Posted by Person_1873 View Post
hey, could you please break that down for me and explain what each part does and how it works?
Code:
for $i in { ls -d /media/usb/music/* } do 
mv /media/usb/music/$1/*/* /media/usb/music/$1/ 
done
for $in in { ls -d /media/usb/music/* } do

i defined $i in output of ls -d /media/usb/music/* (which outputs only folders in /media/usb/music/). because this is a for loop, mv /media/usb/music/$1/*/* /media/usb/$1/ will be run every $1's value.
 
Old 01-01-2010, 10:31 PM   #5
Person_1873
Member
 
Registered: Sep 2007
Location: Australia
Distribution: Arch Linux
Posts: 489

Original Poster
Rep: Reputation: 39
thankyou, i just couldnt see where $i was defined, thankyou for that
 
Old 01-02-2010, 05:13 AM   #6
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 671

Rep: Reputation: 94
Quote:
Originally Posted by Person_1873 View Post
thankyou, i just couldnt see where $i was defined, thankyou for that
$i comes from the for loop
 
  


Reply

Tags
music, sorting


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing large amounts of data to multiple CD/DVD's enine Linux - General 1 09-03-2009 09:32 AM
System uses large amounts of memory and does not release it dralexpe Linux - Software 6 11-26-2007 09:31 PM
Kernel panics when trying to transfer large amounts of data from or to my hardrive CuriouserAndCur Debian 3 01-10-2007 11:53 AM
Using wget to copy large amounts of data via ftp. AndrewCAtWayofthebit Linux - General 1 05-11-2006 11:55 AM
rm command is choking on large amounts of data? Jello Linux - General 18 02-28-2003 07:11 PM


All times are GMT -5. The time now is 07:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration