create Txt and zip

阅读更多
call createTxtfileWithSeq()
call zipFile("D:\TestData\MPCI\80\vbs")

Function createTxtfileWithSeq()
set fso=createobject("Scripting.filesystemobject")
for i=0 to 3
	for j=0 to 9
		if i=0 and j=0 then
			j=j+1
			end if 
		if i=3 and  j=2 then 
			exit for
			exit for
			end if 
		set myfile=fso.createtextfile("D:\TestData\MPCI\80\vbs\ycap_ls_201303"&i&j&".txt",True)
	next
next
myfile.close
end function

Function zipFile(path)
dim objfolder
dim folderpath
dim folderinfo
folderpath=path
set objfolder=createobject("scripting.filesystemobject")
set folderinfo=objfolder.getfolder(folderpath)
set ffiles=folderinfo.files
for each f1 in ffiles
	set oExec = createobject("wscript.shell").exec("7z a -tgzip "&folderpath&"\"&f1.name&".gz "&folderpath&"\"&f1.name)
	'msgbox folderpath&"\"&f1.name
next
end function

你可能感兴趣的:(create Txt and zip)