<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > FIL. - File-Commands > FIL. - File-Commands |
MiniRobotLanguage (MRL)
FIL.Split File
Split large File into smaller files
Intention
This command is used to split large files up to any size (64-bit) can be splitted into smaller files - for example to send them away via Mail.
The receiver can use the
FIL.Join File
or the
FIL.Join delete
command to restore the original file. The only difference between these two is, that the first command does not automatically delete the split-files after restoring the original file.
Usage of the command is simple:
VAF.$$FIA=?path\File.exe
FIL.SPLIT FILE|$$FIA|16000
would split the File into pieces of each 16000 Bytes, Of course the last piece may have a different size, as it contains just the remaining Bytes.
Also note that the FIL.Split File command has two dependencies on global settings.
Here is an example, how the File-Splitting looks in an explorer folder:
On the right side is the content of the "SPL_INFO.txt"-file.
All lines are separated with $crlf$.
All the split-files are numbered and have currently the extension "spl".
The file "SPL_INFO.txt" contains all informations that are needed for the the
FIL-Join File command to put the files together.
You can see an example, in the picture on the right side.
First it contains the original Filename of the file before it was splitted.
Secondly it contains all the filenames of the splitter-files in the right order.
Any changes you make in the "SPL_INFO.txt" will lead to changes in the final outcome.
There are no additional information on the splitting process in the splitter-files.
Therefore an "SPL_INFO.txt" is needed to concatenate these files to the original file.
Syntax
FIL.Split File|P1|P2[|P3][|P4]
Parameter Explanation
P1 - Filename and Path.
P2 - numerical, size of the Split-Files in Bytes.
If you plan to send the files via E-Mail to somebody,
you could for example choose 12000000 (12 MB).*
P3 - (optional) Variable for Target Folder. If omitted,
?path\ is taken.
P4 - (optional) Variable for 16 Byte-Key for TEA Encryption
of splitted files. If omitted a hardcoded password is used.
Of course anybody who owns a SPR can then decrypt the files.*
There are 2 dependencies on global settings:
*If "compression and encryption" is used, the size of the resulting files may
be smaller then the given number in P2. To decide whether "compression and encryption" should be used, Set
OPT.SPLITCOMP|1
to 0 or 1. The default number of rounds (encryption strength) is 30.
You can change that using
OPT.ENCRYPT|100
this will set the default encryption to 100 rounds.
Example
'*****************************************************
' EXAMPLE 1: FIL.Split File
'*****************************************************
' no compression/encryption (default)
OPT.SPLITCOMP|0
VAF.$$FIA=?path\Textfile.txt
VAF.$$FIB=?path\TextfileX.txt
FIL.SPLIT FILE|$$FIA|160
REN.$$FIA|$$FIB|1000
' automatically delete splitted files after
' restoring the original file
FIL.join delete
ENR.
'*****************************************************
' EXAMPLE 2: FIL.Split File / FIL.Join Delete
'*****************************************************
' enable compression/Encryption
OPT.SPLITCOMP|1
' Set encryption to 100 TEA Rounds
OPT.ENCRYPT|100
' Time-Measurement
VAR.$$TIA=#dtime#
VAF.$$FIA=?path\Textfile.txt
VAF.$$FIB=?path\TextfileX.txt
FIL.SPLIT FILE|$$FIA|160
ITO.
goto ero
EIF.
VAR.$$TIB=#dsince#
PRT.Split took:$$TIB
MBX.!
REN.$$FIA|$$FIB|1000
OPT.SPLITCOMP|1
VAR.$$TIA=#dtime#
FIL.join delete
ITO.
GTO. ero
EIF.
VAR.$$TIB=#dsince#
PRT.Join took:$$TIB
:enx
MBX.!
ENR.
:ero
MBX.Got TIO
GTO. enx
Remarks
Time considerations:
In my testing environment, I tested to split a file of 6.85 GB into 49 Pieces.
The needed time with compression and encryption was: 10.5 Minutes
The needed time without compression and encryption was: 6.5 Minutes
The time needed to join the file was 8.3 Minutes with compression and encryption
and 6 Minutes without compression and encryption.
Limitations:
The Splitter works with 64 bit internally. Therefore files of up to 18446744073709551615 Bytes can be splitted to smaller split-files. But there is a limit on the size of these splitted files.
Due to speed-considerations, the split-files can not exceed ~1-2 GB (depending on the pool of free 32-bit Memory in WOW64).
There is no limit on the number of Split-Files that you can generate (other then 32-bit).
See also:
• IEF. / NEF. - If - exist - File