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.
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:
dir_size() ## calculate total size of files in directory/ies
{
for ds_dir
do
ls -l ${ds_dir:+${ds_dir%/}/} |
grep -v '^d' |
awk 'BEGIN {OFMT = "%d" } {total += $5} END { print total }'
done
}