SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a 9 Gig folder made up of 5 Meg files (*.mp3 files) and I would like to split it in 2 4.5 Gig folders.
What is the best, most efficient Linux command to achieve this?
not sure what you're asking. "folders" (directories) are usually dynamic and only as big as their contents. do you mean a partition is 9GBs and you want to make two partitions?
It sounds to me like someone is trying to archive an MP3 collection onto DVD
I'm afraid I'd be inclined to do it graphically (I use ROX Filer if you wanted a suggestion for X file browsers). Make 2 subdirectories, then select roughly half the contents of the main directory to go in one, and dump the rest in the other. Then tweak it manually (moving one or two files at a time) to get the right balance. Possibly 30 seconds work?
If you have 1,000 9GB directories and you want to split them all in two, or even, you want to split a directory of arbitrary size into 4.5 GB components then a script is likely the best way of doing it. Off the top of my head, I couldn't give you any specific code (that's not true, actually, but scripting is worth learning yourself ) but my script approach would do something like the following:
1. Make a subdirectory that will, eventually, be 4.5 GB. (mkdir fourfiveDir)
2. Use a loop to accomplish the following: (while ... )
* Check the size of the contents of the 4.5 GB directory. (du fourfiveDir)
* If it's less than 4.5 GB then ...
* Find the next file that will fit in the directory. (another loop through all the files in the main dir)
* mv / cp the file into the directory.
* If the 4.5 GB directory is 4.5 GB OR there are no more files that will fit in it from the main directory, exit the loop.
3. Now make another subdir (mkdir fourfiveDir2) and repeat step 2 ... ad nauseum.
If I split visually the 9 Gig file by doing a cut and paste in KDE,
then...OK,
I get 2x4.5 Gig files.
Yes!
But...
K3B doesn't want to burn these files!
I get the message:
===============================================================
System
-----------------------
K3b Version: 0.12
K3b
-----------------------
Size of filesystem calculated: 0
Used versions
-----------------------
mkisofs: 2.1
mkisofs
-----------------------
/usr/bin/mkisofs: Error: '/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,1.mp3' and '/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys, Forrest, Kool & The Gang, Whitney Houston, Madonn
a, Taylor Dayne, Black Box).mp3' have the same Rock Ridge name 'Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,1.mp3'.
/usr/bin/mkisofs: Error: '/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,2.mp3' and '/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys, Forrest, Kool & The Gang, Whitney Houston, Madonn
a, Taylor D.mp3' have the same Rock Ridge name 'Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,2.mp3'.
/usr/bin/mkisofs: Unable to sort directory Shared1
===========================================================
As for the writing of a script is concerned, I don't see how I can test the size of a directory nor increment 1 by 1 the number of files moved to this directory.
Originally posted by jayhel
/usr/bin/mkisofs:
Error:
'/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,1.mp3'
and
'/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys, Forrest, Kool & The Gang, Whitney Houston, Madonna, Taylor Dayne, Black Box).mp3'
have the same Rock Ridge name
'Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,1.mp3'.
/usr/bin/mkisofs:
Error:
'/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,2.mp3'
and
'/usr/multi/music/Shared1/Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys, Forrest, Kool & The Gang, Whitney Houston, Madonna, Taylor D.mp3'
have the same Rock Ridge name
'Disco - Classic 80's Megamix - (Rick Astley, Pet Shop Boys,2.mp3'.
/usr/bin/mkisofs: Unable to sort directory Shared1
As you can see the names are cut in the ISO, and when those names are cut they both have the same name. Just rename them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.