Need help designing script

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 14 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
willsteele
Posts: 9
Last visit: Wed Aug 03, 2011 1:00 pm

Need help designing script

Post by willsteele »

I have a server environment in which 0-byte files occasionally are created. To prevent these files from causing issues, I am trying to create a script to identify these files before customers run into an error. I have tried using a WMI search, but, going through the cim_datafile takes way to long to query. I have over 750,000 files to query. Also, we do not use the Windows Indexing Service, so, I can't query that systemindex. We also have large folder counts. So, I need to iterate through a few thousand folders recursively to run this search. One good thing is that the folder path is relatively predictable and the file extension is the same. More, from a algorithmic perspective, how would it be best to approach a script like this?

Normally, the Windows Explorer runs about 1 hour to complete this search. I am curious, from an academic standpoint, how long it would take a functioning VBScript to perform the same function.
User avatar
willsteele
Posts: 9
Last visit: Wed Aug 03, 2011 1:00 pm

Need help designing script

Post by willsteele »

I have a server environment in which 0-byte files occasionally are created. To prevent these files from causing issues, I am trying to create a script to identify these files before customers run into an error. I have tried using a WMI search, but, going through the cim_datafile takes way to long to query. I have over 750,000 files to query. Also, we do not use the Windows Indexing Service, so, I can't query that systemindex. We also have large folder counts. So, I need to iterate through a few thousand folders recursively to run this search. One good thing is that the folder path is relatively predictable and the file extension is the same. More, from a algorithmic perspective, how would it be best to approach a script like this?

Normally, the Windows Explorer runs about 1 hour to complete this search. I am curious, from an academic standpoint, how long it would take a functioning VBScript to perform the same function.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Need help designing script

Post by jvierra »

DOn't talk about Al Gore's Rhythm here. This is for scripting.

As for the script - I suggest using Com_DataFile and set the folder, drive and use pattern match for teh file name.
SELECT * from Cim_Datafile
WHERE
drive = 'c:'
and path =''
and extension = 'ini'
The above will return boot.ini from teh s drive and very fast.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Need help designing script

Post by jvierra »

YOu have to formulate the rules of teh search in english first. We can then convert that to logic.

From your post it is too difficult to know the exact rules.

There must be some root folder to start with that is constant.

jvierra2009-12-08 20:25:38
This topic is 14 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked