Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
; Setup file names to copy files2copy = StrCat(FilePath(logfile), FileRoot(logfile), "*.*") ; Get count and size of files to copy infoarray = FileInfoToArray(files2copy, 1|2) files2copycnt = infoarray[0,0] files2copysiz = infoarray[0,1] ; Ensure the files will fit onto the backup drive If files2copysiz < DiskFree("C:", 1) Then ((copy files, etc.))
; For standard NTFS volumes moi=IntControl(1004,0,0,0,0) ; name of this wbt file moisize=FileSize(moi) dsize= ((moisize/32768)*32768)+32768 Message(moi,StrCat("Filesize=",moisize,@CRLF,"Disksize=",dsize))In general, disk files are allocated on NTFS disks in multiples of 4096 bytes. Even if the file size is only 200 bytes, it takes 4096 bytes on disk. Other file systems, FAT and FAT32 have, in general, smaller blocksizes, so not as much disk spaces is wasted.
Think of say a 2 page printed memo. The first page is full and only 1/4 of the next page is used. You want to make 2 copies on the office copier machine. If you go my memo size ( 1 and 1/4 pages) and double it, you can figure you will need 2 and 1/2 pages to copy the memo. But when you do it, you find that you need 4 sheets of paper to copy the memo, because, typically, different memos cannot share one piece of paper.
The following function computes the cluster size on any volume. I've tested it on both NTFS and NWFS (NetWare) volumes, and the calculations are correct.
#DefineFunction ClusterSize_P6C ( pDriveLetter ) ; David Gray / WizardWrx rClusterSize = 0 If VarType ( pDriveLetter ) == 2 If StrLen ( pDriveLetter ) == 1 SectorsPerCluster = DiskInfo ( pDriveLetter , 1 ) SectorSize = DiskInfo ( pDriveLetter , 2 ) rClusterSize = SectorsPerCluster * SectorSize EndIf EndIf Return rClusterSize #EndFunction clstr_sz = ClusterSize_P6C ( 'c' ) Message( 'Cluster Size', clstr_sz )Given the cluster size, calculating the space required on the volume is straightforward. Divide the file size by the cluster size, truncate the fractional part of the quotient, and add 1 for the fractional cluster.
Article ID: W17032
File Created: 2007:07:03:14:27:42
Last Updated: 2007:07:03:14:27:42