Split folder into dvd size

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Split folder into dvd size
# 1  
Old 08-25-2009
Question Split folder size into multiple dvd folder's size (without spliting files)

Hello everyone,

I have a big folder in a linux server that contains dozen of big files (total folder size ~ 50 GB)

I have a couple of files of 2.5 GB and some others from 100 MB to 1 GB. (that said it's obvious that it's impossible having two 2.5 GB files in one dvd)

The purpose is to backup all files and burn them into DVD but I would like to maximize each dvd's size so I'm trying to to create a script to split that folder into a couple of folders named DVD1, DVD2, ..., DVDN but I don't have the scripting knowledge needed for this.

Can someone help me please?

Thanks in advance.


Last edited by cabrao; 08-27-2009 at 06:15 AM..
# 2  
Old 08-25-2009
# 3  
Old 08-26-2009
Thanks for your fast answer chompy, but I believe my question is different.

The purpose of my thread is not to split a file or multiple files but split or divide a folder into multiple dvd size folders (about 4.3 GB )

Any idea/help please?

Many thanks
# 4  
Old 08-26-2009

Try the bin-pack script from Chapter 13 of my book, Shell Scripting Recipes. The scripts are available at http://cfaj.freeshell.org/shell/ssr/ssr-scripts.tar.gz

Change the size in the variable bin_size.
# 5  
Old 08-27-2009
Thanks for your answer cfajohnson, however I forgot to mention that I cannot split my files, in other words I just want to divide a big folder and arrange their files into multiple mini folders (max mini folder size about 4.3 GB - dvd size)

Example: Lets say that I have 5 files in a folder:

file1 2.5 GB
file2 2.5 GB
file3 100 MB
file4 500 MB
file5 2.0 GB

The script will check files in the initial folder and will create and move the necessary into new folders (max size about 4.3 GB)

Desired output in this case would be:
- file1 2.5 GB
- file3 100 MB
- file4 500 MB

- file2 2.5 GB

- file5 2.0 GB

Any help? Thanks
# 6  
Old 08-27-2009

The program I mentioned doesn't split files unless they are larger than the maximum size, and that can easily be disabled.
# 7  
Old 09-04-2009
@ cfajohnson:
I'm having some errors with dir_size? where can I find this function? Thanks in advance.

Best regards,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Split the all files in to 8 parts in a folder

Hi, I have different files and i need to split the files in that folder split in to 8 parts with equal number of lines....! any fastest way of doing this in awk. for an example i have a file called "BillingDetails_BaseFile.csv" with total line count 65536 and i need to split in to 8 parts... (1 Reply)
Discussion started by: Raghuram717
1 Replies

2. Red Hat

Copy mismatch while copying RHEL DVD to folder

Hi, Here is this weird thing happening here. I mounted RHEL 6.6 DVD on a directoy /a, I am trying to copy it's content to another folder by using command: cp -pr /a/* /new/folder But while I run ls -lrt on both locations it show me difference in number of files. Any specific reason for that.... (5 Replies)
Discussion started by: nixhead
5 Replies

3. Shell Programming and Scripting

Split the File based on Size

I have a file that is about 7 GB in size. The requirement is I should split the file equally in such a way that the size of the split files is less than 2Gb. If the file is less than 2gb, than nothing needs to be done. ( need to done using shell script) Thanks, (4 Replies)
Discussion started by: rudoraj
4 Replies

4. Shell Programming and Scripting

Split a folder with huge number of files in n folders

We have a folder XYZ with large number of files (>350,000). how can i split the folder and create say 10 of them XYZ1 to XYZ10 with 35,000 files each. (doesnt matter which files go where). (12 Replies)
Discussion started by: AlokKumbhare
12 Replies

5. Shell Programming and Scripting

Getting folder more than 100K size

Hi , I am trying to get the folder details having size more than sme specified value and also the name of the folder should be like TEST. so 1. In the current directory search for all the folders having name like TEST 2. Print the list of the folder names having size more than 100... (3 Replies)
Discussion started by: Anupam_Halder
3 Replies

6. Shell Programming and Scripting

Split file based on size

Hi Friends, Below is my requirement. I have a file with the below structure. 0001A1.... 0001B1.. .... 0001L1 0002A1 0002B1 ...... 0002L1 .. the first 4 characters are the sequence numbers for a record, A record will start with A1 and end with L1 with same sequence number. Now the... (2 Replies)
Discussion started by: diva_thilak
2 Replies

7. UNIX for Dummies Questions & Answers

split files based on size

I have a few txt files in some directory and I need to check their sizes one by one. If any of them are greater than 5mb then I need to split the file in two. Can someone help? Thanks. (6 Replies)
Discussion started by: khanvader
6 Replies

8. UNIX for Dummies Questions & Answers

size of a folder ?

hi, is possible to calculate the size of a folder using ls ? ls -s works only for files.. thanks (2 Replies)
Discussion started by: aneuryzma
2 Replies

9. Solaris

how to split solaris installation dvd to cd?

hello. i have using OpenSolaris 10. i need to split OpenSolaris 10 Dvd to CD's? how i can? thanks. (1 Reply)
Discussion started by: hotjava
1 Replies

10. UNIX for Dummies Questions & Answers

Limit Folder Size

Is there a way to limit a certain folder size(e.g. Documents, Desktop)? :) (2 Replies)
Discussion started by: tisdmin
2 Replies
Login or Register to Ask a Question