I'm working on a script which has a primary function to look for jpg files. I can get it to work if the folder path is just my desktop but if I try the start of the path to be C:\ it errors out. Right now the error has to do with the MID function but I know it is because of me trying to go through all of C:. See the code below and if you can assist me I would really appreciate it.
Set objFSO = CreateObject("Scripting.FileSystemObject") 'objStartFolder is where you enter the folder path string objStartFolder = "C:\" '"C:\Users\Mordred\Desktop\" set objFSO=CreateObject("Scripting.FileSystemObject") 'outputFile is where you enter the path and name of the LogFile text 'file. outputFile = "C:\Users\Mordred\Desktop\LogFile.txt" Set objFolder = objFSO.GetFolder(objStartFolder) set oFile = objFSO.CreateTextFile(outputFile,True) Set colFiles = objFolder.Files 'Loop through the files in the path from above (objStartFolder) For Each objFile in colFiles if (LCase(Mid(objFile.Name, InstrRev(objFile.Name,"."))) = ".jpg") then oFile.Write objFolder & objFile.name & vbCrlf end if Next