Re: Recurse issue - 2nd try
- From: "Roland Hall" <nobody@nowhere>
- Date: Tue, 5 Jul 2005 14:26:40 -0500
"Jeff" wrote in message news:%23uo3AFMgFHA.3232@xxxxxxxxxxxxxxxxxxxxxxx
: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 ---
You can't see the error because of this line:
On Error Resume Next
Comment this line out and run it and see if you get an error.
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
.
- Follow-Ups:
- Re: Recurse issue - 2nd try
- From: Roland Hall
- Re: Recurse issue - 2nd try
- References:
- Recurse issue - 2nd try
- From: Jeff
- Recurse issue - 2nd try
- Prev by Date: Re: Is this possible with NT 4 ?
- Next by Date: Re: How to use function in dll from vbs?
- Previous by thread: Re: Recurse issue - 2nd try
- Next by thread: Re: Recurse issue - 2nd try
- Index(es):
Relevant Pages
|
Loading