Jump to content

Recursively look through deirectories and read section of files


JimC
 Share

Recommended Posts

I am looking for the ability to recursively look down a directory structure for .inf files. read a section of the inf file to verify that files exist in that particular subdirectory. The problem I am having is I dont know how to do a search recursively identify the .inf file in that subdirectory and identify a section in the inf. I though you could use the inireadsection, but that function wont work because it looks for ini files. I have provided an example inf file. I am looking to identify the entries for the [sourceDisksFiles] section. I did present a question yesterday that was probably too long winded as I explained the whole process that I am trying to perform. Thank you in advance for any help you can provide in getting me started.

Link to comment
Share on other sites

First you will need a recursive file search function. There are all kinds:

http://www.autoitscript.com/forum/index.ph...filelisttoarray

Once you get your array created you will have to loop through element and read the file. This will be easy using the ini/inf file format. If your script finds what is needed, break the loop. Simple as that.

Link to comment
Share on other sites

Can you offer any tips on reading a section of the file since I cant use the "inireadsection" function. Thanks in advance for any help.

The inf file should be in the same format as ini, can you post an example?

Link to comment
Share on other sites

Here is a sample driver inf file. Thanks again for any help....

; Copyright © 2003-07 Intel Corporation

; ****************************************************************************

; ****************************************************************************

; ** Filename: iaStor.INF

; ** Revision: Version 7.8.0.1012

; ** Date: 09/29/2007

; ** Abstract: Windows* INF File for Intel® Matrix Storage Manager Driver

; ****************************************************************************

; ****************************************************************************

[version]

CatalogFile=iaStor.cat

Signature="$WINDOWS NT$"

Class=SCSIAdapter

ClassGUID={4D36E97B-E325-11CE-BFC1-08002BE10318}

Provider=%INTEL%

DriverVer=09/29/2007,7.8.0.1012

[DestinationDirs]

DefaultDestDir = 12 ; DIRID_DRIVERS

CopyFullPort = 12;

[CopyFullPort]

iaStor.sys

[sourceDisksNames]

1 = %DiskName%,,,

[sourceDisksFiles]

iaStor.sys= 1

[ControlFlags]

ExcludeFromSelect=PCI\VEN_8086&DEV_2682&CC_0104

ExcludeFromSelect=PCI\VEN_8086&DEV_27C3&CC_0104

ExcludeFromSelect=PCI\VEN_8086&DEV_27C6&CC_0104

ExcludeFromSelect=PCI\VEN_8086&DEV_2822&CC_0104

ExcludeFromSelect=PCI\VEN_8086&DEV_282A&CC_0104

[Manufacturer]

%INTEL%=INTEL_HDC,ntamd64

[iNTEL_HDC]

; ESB2

%PCI\VEN_8086&DEV_2682&CC_0104.DeviceDesc% = iaStor_Inst_RAID, PCI\VEN_8086&DEV_2682&CC_0104

; ICH7R/DH - 82801GR/GH

%PCI\VEN_8086&DEV_27C3&CC_0104.DeviceDesc% = iaStor_Inst_RAID, PCI\VEN_8086&DEV_27C3&CC_0104

; ICH7MR/DH - 82801GHM

%PCI\VEN_8086&DEV_27C6&CC_0104.DeviceDesc% = iaStor_mobl_Inst_RAID, PCI\VEN_8086&DEV_27C6&CC_0104

; ICH8R

%PCI\VEN_8086&DEV_2822&CC_0104.DeviceDesc% = iaStor_Inst_RAID, PCI\VEN_8086&DEV_2822&CC_0104

; ICH8M-E

%PCI\VEN_8086&DEV_282A&CC_0104.DeviceDesc% = iaStor_mobl_Inst_RAID, PCI\VEN_8086&DEV_282A&CC_0104

[iNTEL_HDC.ntamd64]

; ESB2

%PCI\VEN_8086&DEV_2682&CC_0104.DeviceDesc% = iaStor_Inst_RAID, PCI\VEN_8086&DEV_2682&CC_0104

; ICH7R/DH - 82801GR/GH

%PCI\VEN_8086&DEV_27C3&CC_0104.DeviceDesc% = iaStor_Inst_RAID, PCI\VEN_8086&DEV_27C3&CC_0104

; ICH7MR/DH - 82801GHM

%PCI\VEN_8086&DEV_27C6&CC_0104.DeviceDesc% = iaStor_mobl_Inst_RAID, PCI\VEN_8086&DEV_27C6&CC_0104

; ICH8R

%PCI\VEN_8086&DEV_2822&CC_0104.DeviceDesc% = iaStor_Inst_RAID, PCI\VEN_8086&DEV_2822&CC_0104

; ICH8M-E

%PCI\VEN_8086&DEV_282A&CC_0104.DeviceDesc% = iaStor_mobl_Inst_RAID, PCI\VEN_8086&DEV_282A&CC_0104

;****************************************************

[iaStor_Inst_RAID]

AddReg = iaStor_Temp_parameters_AddReg

CopyFiles=CopyFullPort

FeatureScore=0x80

[iaStor_mobl_Inst_RAID]

AddReg = iaStor_Temp_parameters_AddReg

CopyFiles=CopyFullPort

FeatureScore=0x80

[iaStor_Inst_RAID.HW]

AddReg = iaStorSecurity.AddReg

[iaStor_mobl_Inst_RAID.HW]

AddReg = iaStorSecurity.AddReg

[iaStorSecurity.AddReg]

HKR,,Security,,"D:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FRFW;;;BU)"

[iaStor_Temp_parameters_AddReg]

[iaStor_Inst_RAID.Services]

AddService = iaStor, %SPSVCINST_ASSOCSERVICE%, iaStor_Service_Inst, iaStor_EventLog_Inst

[iaStor_mobl_Inst_RAID.Services]

AddService = iaStor, %SPSVCINST_ASSOCSERVICE%, iaStor_mobl_Service_Inst, iaStor_EventLog_Inst

[iaStor_Service_Inst]

DisplayName = %*PNP0600.DeviceDesc%

ServiceType = %SERVICE_KERNEL_DRIVER%

StartType = %SERVICE_BOOT_START%

ErrorControl = %SERVICE_ERROR_NORMAL%

ServiceBinary = %12%\iaStor.sys

LoadOrderGroup = SCSI Miniport

AddReg = iaStor_parameters_AddReg

[iaStor_mobl_Service_Inst]

DisplayName = %*PNP0600.DeviceDesc%

ServiceType = %SERVICE_KERNEL_DRIVER%

StartType = %SERVICE_BOOT_START%

ErrorControl = %SERVICE_ERROR_NORMAL%

ServiceBinary = %12%\iaStor.sys

LoadOrderGroup = SCSI Miniport

AddReg = iaStor_mobl_parameters_AddReg

[iaStor_parameters_AddReg]

HKR,,Tag,%REG_DWORD%,25

HKR,Parameters,queuePriorityEnable,%REG_DWORD%,0

HKR,Parameters,BusType,0x00010001,0x0000008

HKR,Parameters\Port0,%AN%,0x00010001,0

HKR,Parameters\Port0,%LPM%,0x00010001,0

HKR,Parameters\Port0,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port0,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port0,%GTF%,0x00010001,0

HKR,Parameters\Port0,%DIPM%,0x00010001,0

HKR,Parameters\Port1,%AN%,0x00010001,0

HKR,Parameters\Port1,%LPM%,0x00010001,0

HKR,Parameters\Port1,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port1,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port1,%GTF%,0x00010001,0

HKR,Parameters\Port1,%DIPM%,0x00010001,0

HKR,Parameters\Port2,%AN%,0x00010001,0

HKR,Parameters\Port2,%LPM%,0x00010001,0

HKR,Parameters\Port2,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port2,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port2,%GTF%,0x00010001,0

HKR,Parameters\Port2,%DIPM%,0x00010001,0

HKR,Parameters\Port3,%AN%,0x00010001,0

HKR,Parameters\Port3,%LPM%,0x00010001,0

HKR,Parameters\Port3,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port3,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port3,%GTF%,0x00010001,0

HKR,Parameters\Port3,%DIPM%,0x00010001,0

HKR,Parameters\Port4,%AN%,0x00010001,0

HKR,Parameters\Port4,%LPM%,0x00010001,0

HKR,Parameters\Port4,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port4,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port4,%GTF%,0x00010001,0

HKR,Parameters\Port4,%DIPM%,0x00010001,0

HKR,Parameters\Port5,%AN%,0x00010001,0

HKR,Parameters\Port5,%LPM%,0x00010001,0

HKR,Parameters\Port5,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port5,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port5,%GTF%,0x00010001,0

HKR,Parameters\Port5,%DIPM%,0x00010001,0

[iaStor_mobl_parameters_AddReg]

HKR,,Tag,%REG_DWORD%,25

HKR,Parameters,queuePriorityEnable,%REG_DWORD%,0

HKR,Parameters,BusType,0x00010001,0x0000008

HKR,Parameters\Port0,%AN%,0x00010001,0

HKR,Parameters\Port0,%LPM%,0x00010001,1

HKR,Parameters\Port0,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port0,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port0,%GTF%,0x00010001,0

HKR,Parameters\Port0,%DIPM%,0x00010001,1

HKR,Parameters\Port1,%AN%,0x00010001,0

HKR,Parameters\Port1,%LPM%,0x00010001,1

HKR,Parameters\Port1,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port1,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port1,%GTF%,0x00010001,0

HKR,Parameters\Port1,%DIPM%,0x00010001,1

HKR,Parameters\Port2,%AN%,0x00010001,0

HKR,Parameters\Port2,%LPM%,0x00010001,1

HKR,Parameters\Port2,%LPMSTATE%,0x00010001,0

HKR,Parameters\Port2,%LPMDSTATE%,0x00010001,1

HKR,Parameters\Port2,%GTF%,0x00010001,0

HKR,Parameters\Port2,%DIPM%,0x00010001,1

[iaStor_EventLog_Inst]

AddReg = iaStor_EventLog_AddReg

[iaStor_EventLog_AddReg]

HKR,,EventMessageFile,%REG_EXPAND_SZ%,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\iaStor.sys"

HKR,,TypesSupported,%REG_DWORD%,7

;********************************************************

; Extra Registry Entries

[strings]

DiskName = "Intel Matrix Storage Manager Driver"

*PNP0600.DeviceDesc = "Intel RAID Controller"

PCI\VEN_8086&DEV_2682&CC_0104.DeviceDesc = "Intel® 631xESB/632xESB SATA RAID Controller"

PCI\VEN_8086&DEV_27C3&CC_0104.DeviceDesc = "Intel® 82801GR/GH SATA RAID Controller"

PCI\VEN_8086&DEV_27C6&CC_0104.DeviceDesc = "Intel® 82801GHM SATA RAID Controller"

PCI\VEN_8086&DEV_2822&CC_0104.DeviceDesc = "Intel® ICH8R/ICH9R SATA RAID Controller"

PCI\VEN_8086&DEV_282A&CC_0104.DeviceDesc = "Intel® 82801HEM SATA RAID Controller"

INTEL="Intel"

AN="AN"

LPM="LPM"

LPMSTATE="LPMSTATE"

LPMDSTATE="LPMDSTATE"

GTF="GTF"

DIPM="DIPM"

;*******************************************

;Handy macro substitutions (non-localizable)

SPSVCINST_ASSOCSERVICE = 0x00000002

SERVICE_KERNEL_DRIVER = 1

SERVICE_BOOT_START = 0

SERVICE_ERROR_NORMAL = 1

REG_EXPAND_SZ = 0x00020000

REG_DWORD = 0x00010001

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...