打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
归集指定目录下指定类型文件

归集指定目录下指定类型文件  

2011-04-11 10:57:05|  分类: 电脑应用 |  标签: |字号 订阅

将C:\Documents and Settings\All Users\temp\目录下的PDF文件归集到E:\FAX\

Function FilesTree(sPath)
  Set oFso = CreateObject("Scripting.FileSystemObject")
  Set oFolder = oFso.GetFolder(sPath)
  Set oSubFolders = oFolder.SubFolders
  Set oFiles = oFolder.Files
  Dpath ="E:\FAX\"

  For Each oFile In oFiles
    IF Right(oFile.Name,4) = ".pdf" Then
       Set file=oFso.getfile(oFile.Path)
       renname =year(DateValue(file.datelastmodified))&"."&month(DateValue(file.datelastmodified))&"."& _
              day(DateValue(file.datelastmodified))&"-"&hour(TimeValue(file.datelastmodified))&"."& _
              minute(TimeValue(file.datelastmodified))&"."&second(TimeValue(file.datelastmodified))
             'WScript.Echo mdate
       oFso.CopyFile file,Dpath,true
       Set file2=oFso.GetFile(Dpath & oFile.Name)
       file2.Name=renname & Right(file2.Name,4)
       oFso.deletefile file
    End IF

  Next

  For Each oSubFolder In oSubFolders
    FilesTree(oSubFolder.Path)
  Next
      
  Set oFolder = Nothing
  Set oSubFolders = Nothing
  Set oFso = Nothing
End Function
 
FilesTree("C:\Documents and Settings\All Users\temp\")

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
使用Office内置的VBA编辑器实现WORD文档的批量查找替换
VBS 遍历文件夹下所有Excel文件
VB6.0函数返回数组示例 - 木子屋 和另外 4 个页面 - 用户配置 1
遍历本地文件夹并建立超链接
删除N天以前修改过的文件,代码
javascript读写本机文本文件
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服