Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculate file size
#1
i send a 700mb file to my dialog and on button click all relevant parameters are passed to winrar.
when winrar is finished my function returns OK.
the parts are split into 100mb files (104857 KB)

what i need to know is how to generate the resulting segment file names.

test.part1.rar
test.part2.rar
test.part3.rar
etc.

i have a grey area for mathematics in my brain.
that is because i was not able to draw enough attention to it in school.

thanks.
pi
#2
Macro
Code:
Copy      Help
out
long file_size=700*1024*1024+10
long part_size=100*1024*1024

;-------------------

int n=file_size/part_size
long last_part_size=file_size%part_size; if(last_part_size) n+1; else last_part_size=part_size
int i
str s
for i 0 n
,s.format("test.part%i.rar" i+1)
,out "%s, offset=%I64i, size=%I64i" s i*part_size iif(i<n-1 part_size last_part_size)
#3
thats pretty cool.
i just tried that on my mp3 folder.

Macro
Code:
Copy      Help
str _file="C:\Windows\ntbtlog.txt"
_file="D:\mp3"
long fz = GetFileOrFolderSize(_file)
;out fz

;out
;long file_size=700*1024*1024+10
long file_size=fz
long part_size=100*1024*1024

;-------------------
;
int n=file_size/part_size
long last_part_size=file_size%part_size; if(last_part_size) n+1; else last_part_size=part_size
int i
str s
for i 0 n
,s.format("%s.part%i.rar" _file.getfilename i+1)
,out "%s, offset=%I64i, size=%I64i" s i*part_size iif(i<n-1 part_size last_part_size)
pi


Forum Jump:


Users browsing this thread: 1 Guest(s)