RegExp for entire paths/subpaths

Results 1 to 2 of 2

Thread: RegExp for entire paths/subpaths

  1. #1
    Join Date
    Dec 1969

    Default RegExp for entire paths/subpaths

    How would one iterate through an entire tree and run a RegExp on all specified types of files. For example, change all the html files on a web site?

  2. #2
    Join Date
    Dec 1969

    Default RE: RegExp for entire paths/subpaths

    following code is something I whipped up! not the cleanest ? (maybe, I haven&#039;t dim&#039;d any vars!) however it does work, replace YOURPATH with whichever path you want to run the code on, also replace CALLSOMEFUNCTION with the function you want to run on each file. pretty simple if you know how!<BR>&#060;%<BR>Set objFileSystem = CreateObject("Scripting.FileSystemObject")<BR>Set objFolder = objFileSystem.GetFolder(server.mappath("YOURPATH") )<BR>Set objFileCollection = objFolder.files<BR><BR>For Each file in objFileCollection<BR> strFilename = strReverse(<BR> nDotPos = instr(strFilename,".")<BR> strFileExt = right(strReverse(strFileName),nDotPos)<BR> if lcase(strFileExt) = ".html" or lcase(strFileExt) = ".htm" then<BR> CALLSOMEFUNCTION<BR> end if<BR>Next<BR><BR>Set objFileSystem = nothing<BR>Set objFolder = nothing<BR>Set objFileCollection = nothing<BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts