Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open a directory and get the .inf files

Status
Not open for further replies.

mtrasp

Programmer
Jun 15, 2009
35
US
Hi I am unable to set the path and get the values from one directory..below is the my code

$filespec = "$Path\\*.inf";

@INFFiles = `dir /b $filespec`;

foreach $infFile (@INFFiles)
{
open(INF, "<$Path\\$infFile") || writelog(logdie,"Could not open $Path\\$infFile");
@Contents = <INF>;
@match = grep(/DriverVer=/, @Contents);
close INF;
}
my ($prefix, $VersionNumber) = split(',', $match[0]);
$VersionNumber =~ s/[^\d+\.\d+\.\d+\.\d+]//g; # Removes comments and such.
chomp $VersionNumber;
writelog(debug,"pr_UpdateComponent $MyVersionID, $VersionNumber");
ExecStoredProcedure("pr_UpdateComponent", "$MyVersionID,'$VersionNumber'");


in the above code i need to use some path like 7sdev8800\working\....\....\.. instead of $path.how can i change that please help me.urgent

in the above code $path is pointing to the another directory i need to change 7sdev8800\working\....\....\..and get the .inf files from that directory....please help me
 
Here's a short snippit that may help with identifying the INF files.
Code:
my $path = 'c:/path/to/inf/files/';
opendir DH, "$path";
	foreach (readdir DH) {
		next unless /\.inf$/;
		print "$_\n";
	}
closedir DH;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top