Try this VBScript:
- Copy the following to Notepad, and save the file as "deltemp.vbs"
- Start the Import wizard.
- Then double-click deltemp.vbs to run it.
The script will clean up the acq*tmp.??? files every 5 seconds. This will reduce file name collisions as much as possible.
The script will quit automatically once the Import Wizard is closed.
'Code starts here
Dim FSO: Set FSO = WScript.CreateObject("Scripting.FileSystemObject")
TmpFldr = FSO.GetSpecialFolder(2)
WaitForProcess ".", "rundll32.exe"
WScript.Echo "The Import wizard is not running. The script will now quit."
Sub WaitForProcess(strComputer, strProcess)
Dim wmiQuery : wmiQuery = "Select * From Win32_Process Where Name='" _
& strProcess & "'" & " AND CommandLine LIKE '" _
& "%photoAndVideoAcquire%" & "'"
Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2")
Dim colItems : Set colItems = objWMIService.ExecQuery(wmiQuery)
Dim intProcCount : intProcCount = colItems.Count
Do While intProcCount > 0
Set colItems = objWMIService.ExecQuery(wmiQuery)
intProcCount = colItems.Count
WScript.Sleep 5000
Call DelAcqTemp
Loop
End Sub
Sub DelAcqTemp
NumSeconds = 5 'anything older than this many seconds will be removed.
Dim objFolder
Dim objFile
Dim objSubfolder
Set objFolder = fso.GetFolder(TmpFldr)
'DELETE Acq* files in TempFolder Path older than x seconds
For Each objFile In objFolder.files
If LCase(FSO.GetExtensionName(objFile)) <> "tmp" And _
Left(LCase(FSO.GetBaseName(objFile)),3) = "acq" Then
On Error Resume Next
If DateDiff("s", objFile.DateCreated,Now) > NumSeconds Then
objFile.Delete True
End If
On Error GoTo 0
End If
Next
End Sub
'Code ends here