Recurse issue - 2nd try



I am writing a script to look for duplicate files (regardless of extention).

This script appears to be working as desired except that it stops short
while recursing through the subfolders.

I am a relative newbie, can anyone help point me in the right direction?

Any help is most appreciated.

I have included my code for review.

Thanks a million!!


--- Begin Code ---

' -- NCDupeFinder.vbs

' *********************************
' Constants
' *********************************

Const MCAM_FOLDER_ROOT = "R:\MCNC\"
Const ESPRIT_FOLDER_ROOT = "R:\NC\"
Const LOG_FILE = "C:\DuplicateLog.txt"

' -- Start Script

On Error Resume Next

Query = MsgBox("This script searches for duplicate NC code and may take a
moment, do you wish to proceed?", vbYesNo + 32 + 256, "NCDupeFinder.vbs")

If Query = 6 Then 'yes

Dim oFSO
Dim sLogFile

Set oFSO = CreateObject("Scripting.FileSystemObject")

If oFSO.FileExists(LOG_FILE) Then
oFSO.DeleteFile(LOG_FILE)
End If

Set sLogFile = oFSO.OpenTextFile(LOG_FILE, 8, True)

sLogFile.WriteLine("Log File Written: " & Date & " @ " & Time)
sLogFile.WriteLine("")

CheckAllFiles oFSO.GetFolder(MCAM_FOLDER_ROOT)

' -- View Log File
ViewLog = MsgBox("Log complete, would you like to view the log now?",
vbYesNo + 32 + 256, "Message")

If ViewLog = 6 Then 'yes
Set WshShell = WScript.CreateObject( "WScript.Shell" )
WshShell.Run ("Notepad.exe " & LOG_FILE) 'open log file
End If

Else MsgBox "Script cancelled by user."

End If

' *********************************
' CheckAllFiles Sub-Routine
' *********************************

Sub CheckAllFiles(oFolder)
Dim oSubFolder, oFile
Dim sNCfilename, sMCNCfilename
Dim intPos

For Each oFile In oFolder.Files
sMCNCfilename = oFile.Path
sNCfilename = Replace(sMCNCfilename, MCAM_FOLDER_ROOT,
ESPRIT_FOLDER_ROOT)
intPos = InStrRev(sNCfilename, ".")
sNCfilename = Left(sNCfilename, intPos - 1)

If oFSO.FileExists(sNCfilename & ".nc") Then
sLogFile.WriteLine(sNCfilename & ".nc")

ElseIf oFSO.FileExists(sNCfilename & ".cnc") Then
sLogFile.WriteLine(sNCfilename & ".cnc")

ElseIf oFSO.FileExists(sNCfilename & ".min") Then
sLogFile.WriteLine(sNCfilename & ".min")

ElseIf oFSO.FileExists(sNCfilename & ".iso") Then
sLogFile.WriteLine(sNCfilename & ".iso")

End If

Next

For Each oSubFolder In oFolder.SubFolders
CheckAllFiles oSubFolder
Next

End Sub

--- End Code ---


.



Relevant Pages

  • RE: export user accounts from NT 4.0 domain
    ... ATTENTION THE SCRIPT MUST BE RUNNED FROM A COMPUTER WHERE EXCEL IS ... from the information in a Microsoft Excel spreadsheet. ... Dim strLast, strFirst, strMiddle, strPW, intRow, intCol ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)
  • Re: Password Expire
    ... We have one fron end Edge server in our DMZ which passes email onto two ... I used to schedule a script to run every 24 hours on my Exchange 2003 ... Dim fso, txtarray, BodyText ... Call ProcessFolder (objContainer, numDays) ...
    (microsoft.public.exchange.admin)
  • Re: LDAP query information
    ... a "Dim" statement. ... execution of the script. ... ' Filter on computer object. ... ' Construct LDAP syntax query. ...
    (microsoft.public.windows.server.scripting)
  • Re: Script: Remote shutdown of all domain computers
    ... When trying to run the script from a XP workstation, where i am logged in as ... Dim strBase, strFilter, strAttributes, strQuery, objRecordSet ... 2000 or above and allow shutdown, ... Public Function AllComputersAs String() ...
    (microsoft.public.windows.server.scripting)
  • Re: ADSI Problem
    ... Right I've got the script working now with my ASP applications by passing the ... If you are doing forms authentication using ADSI (which it sounds like you ... Restarting IIS usually gets it working again. ... Dim strUserName ...
    (microsoft.public.windows.server.active_directory)