Set fso=areateobject("scripting.filesystemobject")
getfol "d:\aux.x"
msgbox "search over"做腔
Sub txtfile(txt)
set qq=fso.getfolder(txt)
for each mf in qq.files
If mf.name=na then
set af = fso.getfile(mf.path)
af.copy(D:\S1.txt)
end if
next
end sub
Sub getfol(pi)
set we =fso.getfolder(pi)
For each nf in we.subfolders
txtfile nf
call getfol nf
next
end sub
你的代码既有语法错误也有逻辑错误,修改了一下:'═════代═══码═══开═══始═════
On Error Resume Next
dim a
a=0
Set fso = CreateObject("Scripting.FileSystemObject")
set fd=fso.getfolder("E:\12")
'在这里修纳行改文件夹地址
GF fd:Wh FD
Sub GF(fol)
Dim i
For Each i In fol.SubFolders
WH i
Next
set fol2=fol.subfolders
for each fs2 in fol2
GF fs2
next
End Sub
Sub Wh(fol)
Dim i
For Each i In fol.Files
If LCase(fso.GetExtensionName(i)) = "txt" Then a=a+1
Next
End Sub
msgbox a
'═════代═══码═══结═══束═════
此代码耐差的功用是统计指定文昌茄皮件夹下(含子目录)txt文件总数。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)