UNIX software development, in general, we will use the tools under Windows Development test, and then upload to UNIX (test), but usually the tool is stored in the DOS format, upload it will often have some problems (such as ClearCase down after the increase of line-wrapping, Oracle stored procedures, Unix shells, etc., so we need to convert the format to UNIX format and then upload. This VBScript script is a conversion tool. Of course, we can also use tools such as eclipse,notepad++ to convert.
Dos2unix.vbs
This is the script for translating files in Windows format to UNIX format. Maybe you always meet this situation so you create or edit your files on Windows but can ' t work when upload to UNIX, th Is tool can help for solve this issue.
---------------------------------------------------------------------------------
On Error Resume Next
Dim Fso
Set Fso = WScript. CreateObject ("Scripting.FileSystemObject")
Dos2unixfolder (".")
MsgBox "Finished dos2unix!"
Function Dos2unixfolder (ByVal path)
Dim fd
Set fd= fso.getfolder (path)
If FD. Files.count > 0 Then
For each MYF in FD. Files
If Right (LCase (MYF). Name), 6 <> ". Class" And Right (LCase (MYF). Name), 4 <> ". xml" Then
Dos2unixfile (path& "/" &MYF. Name)
End If
Next
End If
If fd.subfolders.Count > 0 Then
For each myfd in Fd.subfolders
Dos2unixfolder (path& "/" &MYFD. Name)
Next
End If
End Function
function Dos2unixfile (FilePath)
Set F=fso.opentextfile (FilePath)
S=replace (F.READALL,VBCRLF,CHR) ' Replace DOS to UNIX FORMAT:VBCRLF=CHR chr (10)
F.close
Set R=fso.opentextfile (filepath,2,true)
R.write s
End Function
---------------------------------------------------------------------------------
This article from the "Small Hebebe Technical Space" blog, please be sure to keep this source http://babyhe.blog.51cto.com/1104064/247256
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/unix/