Fw: [VBS-] 档案移到资料夹

楼主: unfinish (百年孤寂)   2014-06-24 23:50:30
※ [本文转录自 EzHotKey 看板 #1JgIrAM2 ]
作者: unfinish (笑吟吟的淫淫笑) 看板: EzHotKey
标题: [VBS-] 档案移到资料夹
时间: Tue Jun 24 15:48:23 2014
下面这段程式在VBA底下可以正常执行
存成.vbs之后 执行时没有异常讯息
但是也没有任何执行效果
没有移动任何档案甚至连建立新的资料夹都没有
有人可以告诉我是出了什么问题吗
谢谢大家
Sub FileSeparator()
Dim FSO, MyFiles
Dim DateLastModified, FileName, FolderPath
Dim FileInfo
FolderPath = "D:\TEST"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set MyFiles = FSO.getfolder(FolderPath)
For Each FileInfo In MyFiles.Files
FileName = FileInfo.Name
DateLastModified = Format(FileInfo.DateLastModified, "YYMMDD")
If Not FSO.FolderExists(FolderPath & "\" & DateLastModified) Then
FSO.CreateFolder (FolderPath & "\" & DateLastModified)
End If
FSO.MoveFile FolderPath & "\" & FileName, FolderPath & "\
" & DateLastModified & "\"
Next
End Sub

Links booklink

Contact Us: admin [ a t ] ucptt.com