LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 08-11-2005, 10:05 PM   #1
jayhel
Member
 
Registered: Nov 2004
Location: Montreal
Distribution: Slackware 14.1
Posts: 161

Rep: Reputation: 15
How to split a 9 Gig folder in 2x4.5 Gig folders


Hi!

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?

Tks,

JL
 
Old 08-11-2005, 10:17 PM   #2
synaptical
Senior Member
 
Registered: Jun 2003
Distribution: Mint 13/15, CentOS 6.4
Posts: 2,020

Rep: Reputation: 46
umm, mkdir?




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?
 
Old 08-12-2005, 04:49 AM   #3
piete
Member
 
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465

Rep: Reputation: 44
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.

Good luck!
- Piete.
 
Old 08-18-2005, 10:12 PM   #4
jayhel
Member
 
Registered: Nov 2004
Location: Montreal
Distribution: Slackware 14.1
Posts: 161

Original Poster
Rep: Reputation: 15
Split 9 Sig folder in 2x4.5 Gig

Thank you Piete.

However, it is not as simple as it seems.

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

KDE Version: 3.3.2
QT Version: 3.3.3
Kernel: 2.6.10-1
Devices
-----------------------
MATSHITA UJ-845D D100 (/dev/hdb, ) at /mnt/cdrom [CD-R; CD-RW; CD-ROM; DVD-ROM; DVD-R; DVD-RW; DVD+R; DVD+RW; DVD+R DL] [DVD-ROM; DVD-R Sequential; DVD-RW Restricted Overwrite; DVD-RW Sequential; DVD+RW; DVD+R; DVD+R Double Layer; CD-ROM; CD-R; CD-RW] [SAO; TAO; Restricted Overwrite]

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.

Tks,

JL
 
Old 08-18-2005, 10:49 PM   #5
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 51
Re: Split 9 Sig folder in 2x4.5 Gig

Quote:
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.
 
Old 08-18-2005, 11:36 PM   #6
jayhel
Member
 
Registered: Nov 2004
Location: Montreal
Distribution: Slackware 14.1
Posts: 161

Original Poster
Rep: Reputation: 15
Split 9 Sig folder in 2x4.5 Gig

Thank you Gbonvehi!

I renamed the files: K3B is working now.

JL
 
  


Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The Debian install thinks my 60 gig drive is a 33 gig drive! Nebetsu Debian 13 06-04-2005 12:41 AM
Can't see entire ! Gig of memory jhp1 Linux - Hardware 2 10-30-2004 10:24 PM
Why my 80 gig hard drive only shows 70 gig? dsuratman Linux - Newbie 3 11-19-2003 11:54 PM
40 gig hd help Dumpsterm0uth Linux - General 8 02-18-2003 10:26 AM
10 gig hd alameda Linux - Software 3 07-27-2001 07:45 AM


All times are GMT -5. The time now is 04:21 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