Hi,
I found some exemple enabling me to paste the file name and location in a text file, which are present in a giving directory. But I can only do so by defining a specific drive. i.e : strFolder = "C:\tets\"
It doesnt perform a search on a subdirectory.
But I would like to be able to specify "c:\test\" as the starting point and the script would be able to see that a subDirectory name... \"Test2" exist and perform the search ALSO in this subdir.
Actual structure C:\Test\test2\*.txt
*Find all .txt file with name by providing "c:\test\"
I am not very good but here's what I got for the moment.
strFolder = "C:\TEST\"
set fsoObj = CreateObject("Scripting.FileSystemObject")
set objFolder = fsoObj.getfolder(strFolder)
Set oFSO = createobject("scripting.filesystemobject")
Set oNTF = oFS
pentextfile("F:\RESULTsearch.txt",8,True)
Call getInfo(objFolder)
Sub getInfo(pCurrentDir)
For Each aItem In pCurrentDir.Files
If LCase(Right(Cstr(aItem.Name), 3)) = "rpt" Then
oNTF.writeline(aItem.Name & " " & objFolder.Path)
End If
Next
For Each aItem In pCurrentDir.SubFolders
getInfo(aItem)
Next
End Sub
wscript.Echo "END"
Thanks a lot.
I found some exemple enabling me to paste the file name and location in a text file, which are present in a giving directory. But I can only do so by defining a specific drive. i.e : strFolder = "C:\tets\"
It doesnt perform a search on a subdirectory.
But I would like to be able to specify "c:\test\" as the starting point and the script would be able to see that a subDirectory name... \"Test2" exist and perform the search ALSO in this subdir.
Actual structure C:\Test\test2\*.txt
*Find all .txt file with name by providing "c:\test\"
I am not very good but here's what I got for the moment.
strFolder = "C:\TEST\"
set fsoObj = CreateObject("Scripting.FileSystemObject")
set objFolder = fsoObj.getfolder(strFolder)
Set oFSO = createobject("scripting.filesystemobject")
Set oNTF = oFS
Call getInfo(objFolder)
Sub getInfo(pCurrentDir)
For Each aItem In pCurrentDir.Files
If LCase(Right(Cstr(aItem.Name), 3)) = "rpt" Then
oNTF.writeline(aItem.Name & " " & objFolder.Path)
End If
Next
For Each aItem In pCurrentDir.SubFolders
getInfo(aItem)
Next
End Sub
wscript.Echo "END"
Thanks a lot.