 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
lucky_luuk
Joined: 18 Jan 2010 Posts: 12
|
|
Converting files from UNIX to DOS |
|
I'm using statement FileReplaceEx to convert UNIX files to DOS/Windows files.
Converting a (local)file from 7,5 Mb takes about 35 minutes and that's a very long time.
Is it possible to convert such a file in less minutes?
|
|
Mon Jan 18, 2010 11:40 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Yes. It is sure possible. Generally if script performance is an issue, please consider using a VBScript which are generally faster than JAL scripts. As an example of fast processing, a VBScript job can load the entire file into the memory at once, replace symbols and save result in 1 step. Here is a code template for doing that:
 |
 |
Sub Main
Const ForReading = 1, ForWriting = 2
Dim fso, f, t
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)
t = f.ReadAll
Set f = fso.OpenTextFile("c:\converted_testfile.txt", ForWriting, True)
f.Write replace(t, vbLf, vbCrLf)
End Sub |
The above method is not good in case files get very large. To make this process working reliable and able to handle files of any size, consider making the script for reading input file line by line, replacing symbols and writing lines to the output file. It is still should be pretty fast. The on-line VBScript Guide includes description of all required methods including code examples.
Another solution, if you get your file from Unix using FTP, you can set ASCII transfer mode for the FTP and then the resulting file won't need any conversion. This is the most efficient method. For more details see description of JAL's FTPConfig method in the on-line help
|
|
Mon Jan 18, 2010 12:15 pm |
|
 |
lucky_luuk
Joined: 18 Jan 2010 Posts: 12
|
|
|
|
Thanks for the quick answer.
I tried the VBScript but it isn't fast enough.
Is it possible to run a program (executable) after transferring the file(s)?
There are several executables available on the internet (unix2dos.exe...) and they work very fast.
|
|
Wed Jan 20, 2010 10:59 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
Sure., it can be done.
I don't know how you transfer the file. If that is a JAL script type job, you can add RunAndWait command after FTPDownload. For an example use of RunAndWait, either paste this command from Edit/Paste JAL Statement menu, or copy one of the examples from the on-line help file.
|
|
Wed Jan 20, 2010 11:05 am |
|
 |
lucky_luuk
Joined: 18 Jan 2010 Posts: 12
|
|
|
|
Thanks, i'll try it
|
|
Wed Jan 20, 2010 11:44 am |
|
 |
lucky_luuk
Joined: 18 Jan 2010 Posts: 12
|
|
|
|
I made a script with RunAndWait to execute a DOS program in the command line and it was very successful and fast.
|
|
Thu Feb 11, 2010 6:33 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
I'm glad it worked for you.
|
|
Thu Feb 11, 2010 9:41 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|