Looking for optimized way to get the file in subfolders. File exist in lowest level.
Folder A in c:\
Folder A1, A2 in A
Folder A11, A12 in A1 and folder A21 A22 in A2
Folder A111 in A11
File "FileName.exe" in A111
Can anyone tell me How to search the file in the lowest hierarchy? I don't want to use for loop to iterate in all folders
Why don't you want to use a loop?
Tarun Buy the NEW QTP Descriptive Programming Unplugged Book ** Download QTP Unplugged 2nd Edition eBook for FREE **
I believe it is impossible to do what you are asking without looping. Can you provide any more information about the problem?
Problem here is there can be number of folder and verifying the file in all the folders would be very time consuming using for loop. Any mechanism such as WMI or any windows API which can be used for getting the folder structure for the file.
If you can obtain control of the file, then using the attributes the folder can be obtained.The catch here is to find the file location w/o searching through file collection.
Do you have any control over the way the sub folders are created?
Are the folders created at run time?
What is the reason for the folder structure to vary so much?
-- Here to Learn and share ---