越弄越复杂了- Set fso = CreateObject("Scripting.FileSystemObject")
- Do
- f = "" : path = "E:\network data"
- For Each file in fso.GetFolder(path & "\file0").Files
- If LCase(Right(file.Name,4)) = ".txt" Then f = file : Exit For
- Next
- If f = "" Then WScript.Quit
- call main()
- Loop
-
- function main()
- If LCase(fso.GetFile(f).Name) <> "tj.txt" Then
- If fso.FileExists(path & "\file0\tj.txt") Then
- fso.GetFile(path & "\file0\tj.txt").Delete
- End If
- fso.GetFile(f).Name = "tj.txt"
- End If
- Set ws = CreateObject("WScript.Shell")
- ws.Run chr(34) & path & "\P1.EXE" & chr(34),,true
- ws.Run chr(34) & path & "\P2.EXE" & chr(34),,true
-
- n = 3
- While fso.FolderExists(path & "\file" & n)
- n = n + 1
- Wend
-
- strNewFolder = path & "\file" & n
- fso.CreateFolder(strNewFolder)
-
- fso.MoveFile path & "\file1\*",strNewFolder & "\"
- For Each file in fso.GetFolder(path & "\file2").Files
- strNewFile = file.Name
- While fso.FileExists(strNewFolder & "\" & strNewFile)
- strNewFile = "BAK_" & strNewFile
- Wend
- fso.GetFile(file).Move strNewFolder & "\" & strNewFile
- Next
- fso.GetFile(path & "\file0\tj.txt").Delete
- End function
复制代码
|