M626
Programmer
- Mar 13, 2002
- 299
Can anyone help with converting this to vbscrit?
Sub DeleteNotInList()
Dim fso As FileSystemObject
Dim dict As Dictionary
Dim InStream As TextStream
Dim InputData As String
Dim fso_folder As Folder
Dim fso_file As File
Dim Dfile As String
Set fso = New FileSystemObject
Set dict = New Dictionary
Set InStream = fspenTextFile("C:\temp\filelist.txt", ForReading)
Do
InputData = InStream.ReadLine
dict.Add InputData, InputData
Loop Until InStream.AtEndOfStream
Set fso_folder = fso.GetFolder("Z:\flvtemp")
For Each fso_file In fso_folder.Files
Dfile = CreateObject("Scripting.FileSystemObject").GetBaseName(fso_file)
If dict.Exists(Dfile & ".flv") = False Then fso.DeleteFile (fso_file), True
Next fso_file
Set fso_folder = Nothing
Set fso_file = Nothing
dict.RemoveAll
Set dict = Nothing
InStream.Close
Set InStream = Nothing
Set fso = Nothing
End Sub
Sub DeleteNotInList()
Dim fso As FileSystemObject
Dim dict As Dictionary
Dim InStream As TextStream
Dim InputData As String
Dim fso_folder As Folder
Dim fso_file As File
Dim Dfile As String
Set fso = New FileSystemObject
Set dict = New Dictionary
Set InStream = fspenTextFile("C:\temp\filelist.txt", ForReading)
Do
InputData = InStream.ReadLine
dict.Add InputData, InputData
Loop Until InStream.AtEndOfStream
Set fso_folder = fso.GetFolder("Z:\flvtemp")
For Each fso_file In fso_folder.Files
Dfile = CreateObject("Scripting.FileSystemObject").GetBaseName(fso_file)
If dict.Exists(Dfile & ".flv") = False Then fso.DeleteFile (fso_file), True
Next fso_file
Set fso_folder = Nothing
Set fso_file = Nothing
dict.RemoveAll
Set dict = Nothing
InStream.Close
Set InStream = Nothing
Set fso = Nothing
End Sub