List of files to best fit DVD size

Get help with using AutoHotkey and its commands and hotkeys
j-t-r
Posts: 16
Joined: 08 Jun 2015, 03:05

List of files to best fit DVD size

18 Sep 2016, 03:10

Hello,
I use app SizeMe (http://lars.werner.no/?page_id=2) to scan a directory and compare it to how many floppy/zip/CD-R/DVD-discs I need. (Many calls it spanning or span of elements over a medium). It tries to fill each disc up as much as possible, and gives me the result on each disc.
I was wondering if someone knows about similar AHK script/function (or is willing to write one). My usage would be like this:
INPUT: certain directory
OUTPUT: variable one -> list of full paths of files best fit to certain (dvd) capacity, variable two -> percentage filled (so I can prevent burning if dvd capacity is not used above 90% - for example)
I would then use this utitlity (http://www.intelliadmin.com/?p=7019) for command line burning.
I will be grateful for any help you can provide.
Last edited by j-t-r on 18 Sep 2016, 07:06, edited 1 time in total.
User avatar
Masonjar13
Posts: 1488
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: List of files to best fit DVD size

18 Sep 2016, 04:21

Just a simple bit of math. FileGetSize will get the space needed, then simply divide it by the DVD capacity, which can be put in manually or obtained through DriveGet. Round up with ceil().

To be clear, I will not write it, but I will certainly help you write it. If needed, here is the official tutorial.
OS: Windows 7 Ultimate | Editor: Notepad++
My Personal Function Library | Check Out My Computer Rig
User avatar
MilesAhead
Posts: 232
Joined: 03 Oct 2013, 09:44

Re: List of files to best fit DVD size

18 Sep 2016, 06:17

On disc spanning utilities I think the file system and cluster size of the destination media must be accounted for. If you look at ImgBurn it gives some explanation of the various data format options available for burning. To give a stilted example to make the point, if you have txt files averaging 80 bytes each even if the cluster size of the data disc format is only 512 the wasted space per file would average 432 bytes.

The trick to media jamming utilities is to jiggle the order of file writes so as to minimize the wasted space. In this case concatenating the txt files first into a container may help. But there is a difference between file size and spaced used on the media. The latter varies with the target file system/format/cluster size etc..

Edit: of course this only takes into account simple file copy. Some disc spanners convert to an image format so as to max out the target capacity. In any case I am simply passing along what I have picked up over time. I have never attempted to write one of these target space efficiency utilities. :)
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."

- MilesAhead
j-t-r
Posts: 16
Joined: 08 Jun 2015, 03:05

Re: List of files to best fit DVD size

18 Sep 2016, 07:27

Thank you for your replies.
MilesAhead wrote:size of the destination media must be accounted for
Yes, I know:

Code: Select all

SetBatchLines, -1  ; Make the operation run at maximum speed.
FolderSizeKB = 0
WhichFolder = ...
Loop, %WhichFolder%\*.*, , 1
    FolderSizeKB += %A_LoopFileSizeKB%
...
if FolderSizeKB < 4590208
{
runwait, ...\burndisk.exe /write directory drive 
...
j-t-r
Posts: 16
Joined: 08 Jun 2015, 03:05

Re: List of files to best fit DVD size

18 Sep 2016, 11:01

The function as SizeMe does is pretty simple to implement into any script, for instant a VBScript:

Code: Select all

dim oFS, oFolder
set oFS = WScript.CreateObject("Scripting.FileSystemObject")
set oFolder = oFS.GetFolder("c:\")

ShowFolderDetails oFolder

sub ShowFolderDetails(oF)
dim F
wscript.echo oF.Name & ":Size=" & oF.Size
wscript.echo oF.Name & ":#Files=" & oF.Files.Count
wscript.echo oF.Name & ":#Folders=" & oF.Subfolders.count
wscript.echo oF.Name & ":Size=" & oF.Size
for each F in oF.Subfolders
ShowFolderDetails(F)
next
end sub
By using this code as starter and put it into an array, you can group each size of the folders and do a trial/error search based on the size you want to match. SizeMe uses the sum of each directory for 1 level to group, that makes it a hell lot easier to program it.
See http://lars.werner.no/?page_id=2&cpage=6#comment-165110.
User avatar
MilesAhead
Posts: 232
Joined: 03 Oct 2013, 09:44

Re: List of files to best fit DVD size

18 Sep 2016, 13:19

The trade off seems to be human readable data discs vs space utilization. To max out the discs I believe WinRar has a disc spanner mode now. You may be able to get 10% error correction info "free" considering every disc but the last will be used, theoretically, 100%.

Both methods are handy to have.
"My plan is to ghostwrite my biography. Then hire another writer to put his
name on it and take the blame."

- MilesAhead

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], Crusader, Google [Bot] and 202 guests