|
1 | 1 | Option Explicit |
2 | 2 |
|
3 | 3 | 'region License #################################################### |
4 | | -' Copyright 2021 Frank Lesniak |
| 4 | +' Copyright 2023 Frank Lesniak |
5 | 5 | ' |
6 | 6 | ' Permission is hereby granted, free of charge, to any person obtaining a copy of this |
7 | 7 | ' software and associated documentation files (the "Software"), to deal in the Software |
@@ -356,6 +356,10 @@ Dim strOutput |
356 | 356 | Dim objTextStreamFile |
357 | 357 | Dim strTextFile |
358 | 358 | Dim objADODBRecordSet |
| 359 | +Dim strFolderName |
| 360 | +Dim boolIgnoreThisFile |
| 361 | +Dim strFileName |
| 362 | +Dim strFileToIgnore |
359 | 363 |
|
360 | 364 | Const ForReading = 1 |
361 | 365 | Const ForWriting = 2 |
@@ -390,22 +394,35 @@ Else |
390 | 394 | For Each strSubfolderName in arrSubfolderNames |
391 | 395 | If objFileSystemObject.FolderExists(strScriptDir & strSubfolderName & "\") Then |
392 | 396 | Set objFolder = objFileSystemObject.GetFolder(strScriptDir & strSubfolderName & "\") |
| 397 | + strFolderName = objFolder.Name |
393 | 398 | Set objADODBRecordSet = CreateObject("ADODB.RecordSet") |
394 | 399 | objADODBRecordSet.Fields.Append "FilePath", adVarChar, 300 |
395 | 400 | objADODBRecordSet.CursorType = adOpenStatic |
396 | 401 | objADODBRecordSet.Open |
397 | 402 | Set arrFiles = objFolder.Files |
398 | 403 | For Each objFile in arrFiles |
399 | | - On Error Resume Next |
400 | | - objADODBRecordSet.AddNew "FilePath", objFile.Path |
401 | | - 'objADODBRecordSet.Fields(0) = objFile.Path |
402 | | - objADODBRecordSet.Update |
403 | | - If Err Then |
404 | | - On Error Goto 0 |
405 | | - Err.Clear |
406 | | - WScript.Echo("An error occurred processing the file: " & objFile.Path) |
407 | | - Else |
408 | | - On Error Goto 0 |
| 404 | + boolIgnoreThisFile = False |
| 405 | + |
| 406 | + strFileName = objFile.Name |
| 407 | + For Each strFileToIgnore in arrFilesToIgnore |
| 408 | + If strFileToIgnore = (strFolderName & "\" & strFileName) Then |
| 409 | + boolIgnoreThisFile = True |
| 410 | + Exit For |
| 411 | + End If |
| 412 | + Next |
| 413 | + |
| 414 | + If boolIgnoreThisFile = False Then |
| 415 | + On Error Resume Next |
| 416 | + objADODBRecordSet.AddNew "FilePath", objFile.Path |
| 417 | + 'objADODBRecordSet.Fields(0) = objFile.Path |
| 418 | + objADODBRecordSet.Update |
| 419 | + If Err Then |
| 420 | + On Error Goto 0 |
| 421 | + Err.Clear |
| 422 | + WScript.Echo("An error occurred processing the file: " & objFile.Path) |
| 423 | + Else |
| 424 | + On Error Goto 0 |
| 425 | + End If |
409 | 426 | End If |
410 | 427 | Next |
411 | 428 | objADODBRecordSet.Sort = "FilePath" |
|
0 commit comments