我有兴趣了解如何检查以下目录中是否存在多个文件: D:\Files to Move\
我有这个脚本,这是将文件从一个地方移动到另一个地方的第一部分。另一个地方将是我的存档文件夹。我将安排此脚本,以便每天只有新文件存在于此处: D:\Files to Move。
我遇到的问题是,我想知道如何检查是否有4个文件已放入此文件夹?我要安排这个任务,所以不需要在脚本中指定我不相信的时间。有人能帮个忙吗?
with createobject ("Scripting.FileSystemObject")
.MoveFile "D:\Files to Move\*.*", "D:\Move Files Here"
End With发布于 2018-08-01 21:53:27
这应该可以让你开始:
Dim objFso : Set objFso = CreateObject("Scripting.FileSystemObject")
'you can take this as input too using InputBox
Dim strFolderPath : strFolderPath = "D:\Files to Move\"
'this will error if folder doesn't exist.
Dim objFolder : Set objFolder = objFso.GetFolder(strFolderPath)
'display number of files in the folder.
MsgBox objFolder.Files.Count https://stackoverflow.com/questions/51635000
复制相似问题