Saturday, June 19, 2010


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.Open
BinaryInStream.LoadFromFile "c:\1.avi"
i=0
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.Open
BinaryOutStream.Write(buf)
BinaryOutStream.SetEOS
BinaryOutStream.SaveToFile "C:\" & i & ".dat" , 2
BinaryOutStream.Close
WScript.Echo i & ".dat"
i = i + 1
WEND
BinaryInStream.Close
End Function
'here u give the binary file path
'splited files will be created in C:\ drive......check above logic.....
SplitFile("c:\notepad.exe")
'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