Friday, June 4, 2010

How to split any file with script :-D

Thanks to Vineel who gave me this code.

Use the code at your risk, code start from the next line. Copy paste the code into a notepad and change the file name to something.vbs

Function SplitFile(FileName)
'Create Stream object
Dim BinaryInStream
Dim BinaryOutStream
Set BinaryInStream = CreateObject("ADODB.Stream")
BinaryInStream.Type = 1
BinaryInStream.LoadFromFile "c:\1.avi"
WHILE NOT BinaryInStream.EOS
buf = BinaryInStream.Read (5242880) ' 5MB => mention the size of each splited file in bytes
Set BinaryOutStream = CreateObject("ADODB.Stream")
BinaryOutStream.Type = 1
BinaryOutStream.SaveToFile "C:\" & i & ".dat" , 2
WScript.Echo i & ".dat"
i = i + 1
End Function
'here u give the binary file path
'splited files will be created in C:\ drive......check above logic.....
'use following command to recombine them ......... /B means binary files
'copy /B 0.dat+1.dat+2.dat+3.dat+4.dat+5.dat+6.dat+7.dat+8.dat+9.dat+10.dat+11.dat+12.dat+13.dat test.exe
'by vineel

1 comment:

  1. Hello friends,

    The code will read any large file and split it into smaller chuncks so you can copy to stiffy,e-mail or ftp it. This code is for you out there playing with file management etc. It will leave the source file and will create a bunch of smaller files in the same directory. This code can be modified to output directly to the stiffy drive if you want. Thanks a lot.....

    Scrape Web Pages