hi,
I have a very large folder containing hundreds of pictures I’d like to burn them on dvd.
I’m writing some code to split this folder into smaller folder (max 4.3gb) in order to burn them.
but, I need some advice because I don’t know where to start.
I found a lot of tools on internet but mostly on windows, on xojo forum nothing.
Have you got an idea to start?
thanks
Do you need to do this more often? If no, I would say it’s easier to do manually.
If you want to have a simple Xojo application you can do the following:
- Loop through your folder, get path and size of each item.
- Create a new folder for burning.
- Loop through your data structure, copy each item to the new folder until you have gone over 4.3 GB.
HTH
Thank you Beatrix for your advice
first, yes I do it often so I need an app.
so:
- ok
2, ok
3, i think this is the most important part, how do you know how many files fits in the burning folder?
Example:
imagine my original folder is containing these files:
file1: pic.tiff size 1GB add tot 1gb
file2: pic2.tiff size 1GB add tot 2gb
file3: pic3.tiff size 3 GB skip
file 4: pic4.tiff size 500MB add tot 2,5GB
file5: pic5.tiff size 3GB skip
file6: pic6.tiff size 1GB add tot 3,5GB
file7:pic7.tiff size 500MB add tot 4GB
file8:pic8.tiff size 1GB skip
file9:pic9.tiff size 100MB add tot 4,1GB
file10:pic10.tiff size 200MB add tot 4,3GB
in a correct loop the app will add files as table but there are a lot of possible combination of files just to fill a 4.3 dvd
i think i need an algorithm to understand what add and what to skip.
hope to be clear, sorry for my english
[quote=155508:@mario rossi]Thank you Beatrix for your advice
first, yes I do it often so I need an app.
so:
- ok
2, ok
3, i think this is the most important part, how do you know how many files fits in the burning folder?
Example:
imagine my original folder is containing these files:
file1: pic.tiff size 1GB add tot 1gb
file2: pic2.tiff size 1GB add tot 2gb
file3: pic3.tiff size 3 GB skip
file 4: pic4.tiff size 500MB add tot 2,5GB
file5: pic5.tiff size 3GB skip
file6: pic6.tiff size 1GB add tot 3,5GB
file7:pic7.tiff size 500MB add tot 4GB
file8:pic8.tiff size 1GB skip
file9:pic9.tiff size 100MB add tot 4,1GB
file10:pic10.tiff size 200MB add tot 4,3GB
in a correct loop the app will add files as table but there are a lot of possible combination of files just to fill a 4.3 dvd
i think i need an algorithm to understand what add and what to skip.
hope to be clear, sorry for my english[/quote]
It works a bit like packing a piece of luggage.
- You start by sorting your files by decreasing size.
- Then you fetch them and add them in order until the next one does not fit.
- Then you look for the biggest file in your list that fits in the remaining empty space.
- And again until there is no file that fits.
thanks Michel for your answer
now let’s start with some sample code
. maybe it’s useful for all
I’m totally against writing code you can come up with yourself, however I can shed light on your search for Mac tools that will help with disc burning. Disco does spanning, but hasn’t been updated since 2011. No guarantees it works on Yosemite. Toast also does automatic spanning, and has a lot more features than Disco, but also a price tag. There’s a lite version of Toast in the MacAppStore called Toast Burn, but I can’t determine if it does spanning.
Mario:
the FolderItem Class let you know the size of a file:
Use that and add each file length to a variable.
Unfortunately, you will find a rock in your road:
a. Logical size (in volume blocks)
b. Real size (in Bytes).
A text file holding 10 characters will take… far less than a volume block. For more data on the subject, get a single eye on the file info (Get Info) on OS X or the file Properties (Windows): you will see both values.
I do not have an answer for how to deal with that, I do not even know if you have to deal with that (logical size will certainly be higher on modern hard disks than in a DVD).