VBScript可以检测文件夹中当前已修改的文件(包括其中的子文件夹) [英] VBScript to detect today's modified files in a folder (including subfolders inside it)

查看:82
本文介绍了VBScript可以检测文件夹中当前已修改的文件(包括其中的子文件夹)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将所有修改后的文件(包括其中的子文件夹)放在一个文件夹中,并将它们复制到另一个文件夹中。

I need to get all the modified files inside a folder including the subfolders inside it, and copy them to another folder. How can it be done using VBScript or any other way to achieve this?

在此先感谢,

Bibhu

Thanks in advance,
Bibhu

推荐答案

尝试一下(复制少于24小时前修改的文件)

try this (copy files modified less than 24 hrs ago )

Set objFS = CreateObject("Scripting.FileSystemObject")
''# Directory to scan
strFolder = "c:\test"
Set objFolder = objFS.GetFolder(strFolder)
Go( objFolder)

Sub Go(objDIR)
  If objDIR <> "\System Volume Information" Then
    For Each eFolder in objDIR.SubFolders
        Go eFolder
    Next
    For Each strFiles In objDIR.Files
        strFileName = strFiles.Name
        strFilePath = strFiles.Path         
            If DateDiff("h",strFile.DateLastModified,Now) < 24 Then
           objFS.CopyFile strFolder&"\"&strFileName,"c:\tmp"
        End If 

    Next    
  End If  
End Sub

这篇关于VBScript可以检测文件夹中当前已修改的文件(包括其中的子文件夹)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆