思路是:
1.轮询查找C盘(或者其他目录)的所有子目录及子文件夹
2.如果是文件,不是目录,则判断文件的大小,自定义阈值比如100M
3.满足条件的文件,将文件的绝对路径,文件名,文件大小,修改日期等,写入到excel中
注:还有很多缺陷没有做,后续更新,未完待续
dim xlsApp
dim xlsWorkBook
dim xlsSheet
dim fileapp
dim folderdir
dim folderobject
dim subfolderobject
dim filename
dim full_filename
dim subdirpath
dim i
dim clumns
dim rows
dim filesize
'初始化变量
clumns=1
rows=1
'wscriptExcel 对象
Set xlsApp = CreateObject("Excel.Application")
xlsApp.Visible = True
xlsApp.DisplayAlerts=False
'msgbox xlsApp.DisplayStatusBar
'createobject("Scripting.FileSystemObject").GetFolder(".").Path
scriptpath = createobject("Scripting.FileSystemObject").GetFile(Wscript.ScriptFullName).ParentFolder.Path
filename=InputBox("[step 1] input the filename of excel xlsx file", MsgTitle)
full_filename=scriptpath&"\"&filename
'create file
Set objWorkbook = xlsApp.Workbooks.Add()
objWorkbook.SaveAs(full_filename)
'openfile
set xlsWorkBook=

本文介绍了一种利用VBScript遍历C盘(或其他指定目录),查找并记录大于特定大小(如100M)的文件的方法。找到的大文件信息会被保存到Excel表格中,但目前代码仍有待完善。
最低0.47元/天 解锁文章
5368

被折叠的 条评论
为什么被折叠?



