• Welcome to OS2World OLD-STATIC-BACKUP Forum.
 

News:

This is an old OS2World backup forum for reference only. IT IS READ ONLY!!!

If you need help with OS/2 - eComStation visit http://www.os2world.com/forum

Main Menu

Calculate size of files specified in track file (mkisofs2+dvddao)

Started by jep, 2008.04.24, 19:58:30

Previous topic - Next topic

jep

Marked as: Normal
Hello,

here's some code you can use to calculate the space needed for the files you've added to the tracks file.
See topic about mkisofs2 and dvddao

Note: The code may use the attached rexx dll to determine the correct size if it find a file that seem to be >2Gb in size.

/* Check file size to burn */
f.size = 0
do while LINES(ARG(1))
  f.path = TRANSLATE(LINEIN(ARG(1)), '\', '/')
  f.len = POS( '=', f.path )
  if f.len > 0 THEN
    f.path = SUBSTR( f.path, f.len + 1 )
  if stream(f.path, 'c', 'query exists')<>"" then
    f.size = f.size + getFileSize( f.path )
  else if SysFileTree( f.path||'\*.*', 'file', 'SFO' ) = 0 then
  do i = 1 to file.0
    f.size = f.size + getFileSize( file.i )
  end
end
i = 1
f.1 = 'b'
f.2 = 'kb'
f.3 = 'Mb'
f.4 = 'Gb'
f.5 = 'Tb'
f.0 = 5
do while f.size > 1000 & i <= f.0
  f.size = f.size / 1000
  i = i + 1
end
say trunc( f.size, 2 ) f.i
Return 0

getFileSize: procedure
f_size = stream(ARG(1), 'c', 'query size')
if f_size = 1 then do /* File > 2Gb? Then we can use this external library */
  if RxFuncQuery( 'rxLoadFuncs' ) then
  do
    call RxFuncAdd 'rxLoadFuncs', 'rxtnsion', 'rxLoadFuncs'
    call rxLoadFuncs
  end
  f_size = RxFileSize( ARG(1) )
end
Return f_size