Dos2unix Format Conversion VBScript script

Source: Internet
Author: User
Tags chr

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.