Thanks for the response
I tried adapting your code to run in the windows script host, I changed as little as I could to get it to run, but it will only return a list of files in the folder specified and not in all the subfolders, similiar to what i got before with my code.
Im not sure if WSH uses the filesystem object differently or what the problem with the code is. Here is the code of yours that I changed.
I will keep trying, but Im hoping you can see if there is a problem here
Code:
dim path
dim done
dim fileList()
dim processing
dim i
const DESKTOP = "C:\Documents and Settings\wi006gr.PBI\Desktop\pdf"
path=DESKTOP
writetext(ScanFolder(path))
function ScanFolder(FolderPath)
on error resume next
dim fso, folder, file
set fso = wscript.createobject("Scripting.FileSystemObject")
set folder=fso.getFolder(folderpath)
if folderpath<>"" then
e = "Path : " & folderpath & vbnewline
end if
i=1
For Each file In folder.Files
e = e & i & ". " & folderpath & file.name & vbnewline
i=i+1
next
if folderpath<>"" then
e = e & vbnewline
end if
for each f in folder.SubFolders
scanfolder f
next
scanfolder = e
End function
Function WriteText(vTextWrite)
Dim oFs, oTextstream, vText, vFstatus
set oFs = Wscript.createobject("scripting.filesystemobject")
If oFs.FileExists("1.txt") = false then
oFs.CreateTextFile ("1.txt")
end if
set oTextstream = oFs.OpenTextFile("1.txt", 2)
oTextstream.write(vTextwrite)
oTextstream.close
set oTextstream = Nothing
End Function