Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript to burn data files 1

Status
Not open for further replies.

k33

Technical User
Apr 10, 2003
20
0
0
US
Does anyone know of a simple code that can check to see if file size > 650MB and if so, keep breaking the data into 650MB 'chunks' so the data can be burned to a cd. The data needs to remain together because the user will only select an option to burn data, but will not have to select the data to be burned. Thanks.
 

Size Property
For files, returns the size, in bytes, of the specified file. For folders, returns the size, in bytes, of all files and subfolders contained in the folder.

object.Size

The object is always a File or Folder object.

Remarks
The following code illustrates the use of the Size property with a Folder object:

Function ShowFolderSize(filespec)
Dim fso, f, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(filespec)
s = UCase(f.Name) & " uses " & f.size & " bytes."
ShowFolderSize = s
End Function


 
Thanks for your quick response. That takes care of checking the file size, but how do I break the data into 650MB sections? I thought I might be able to use a DoWhile filesz > 650MB, however, I can't figure out how to keep the data together so that the user only has to click once to get all data regardless of file/folder size to burn.
 
i suppose you could keep a running total of the size of the files as you work through adding each file to the 'to burn' list. when you get to the 650mb the files so far are burnt and then you continue on resetin the running total???
 
I have the same problem. This was a lot more common with floppies, and there are a lot of "file splitter" freeware utilities out there. Most of these don't work with large files though, but you can look.

I had a special need. My files were text files, and they had to be split on a line boundary so each CD or floppy after "chopping/splitting/chunking" could be read successfully separately. Most "splitters" leave you with files you must rejoin using another utility or a command line multicopy:

copy split*.txt joined.txt

or

copy split1.txt+split2.txt+split3.txt joined.txt

I wrote my own "chopchop" utility in VB to do this. I'd share it but the terms of my indenture don't permit it. ;-) I'm sure you can find a splitter on the web though.

One time I had to hack one out in VBScript and it was slooow because I was using FSO readln/writeln (NOT the way to go). If you want to go this way read in chunks of maybe 64K bytes and write them out. Just switch to a new output file when the current chunk you've read would put you over your output file size limit.

I don't know of anything that'll let a VBScript write to a CD - unless you have one of the newer "Mount Ranier" drives. But most people can't read that CD format back in anyway.
 
Thanks for the information. I was looking at NERO SDK, but plans have changed, so I won't have to resolve this problem for awhile. Thanks again!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top