要使用相对路径把folderPath的值改成"."或其他正确的相对于脚本的路径- folderPath = "E:\123456"
- On Error Resume Next
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set Folders = fso.GetFolder(folderPath).SubFolders
- for each oFolder in Folders
- fso.MoveFile oFolder.Path & "\*", folderPath & "\"
- fso.MoveFolder oFolder.Path & "\*", folderPath & "\"
- if 0=oFolder.Files.Count and 0=oFolder.SubFolders.Count then
- oFolder.Delete true
- else
- WScript.Echo oFolder.Path & "中的某些文件(夹)移动失败"
- end if
- next
- WScript.Echo "Done"
复制代码
|