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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding files in a specific directories

Status
Not open for further replies.

swgopal

Programmer
Jul 31, 2003
1
0
0
US
Hi,

I need to search for the list of *.a files in a specific directory and run the unix "ar" command to extract the archives.

Ex:
Directory locations could be - /u1/app/dev_1/1.2.3/lib/archive_1.a
/u1/app/dev_2/1.2.3/lib/archive_2.a
/u1/app/dev_3/1.2.3/lib/archive_3.a

Within archive.a we might have set of *.o i.e object files.

Required output:
while running the extract command on archive_*.a files we need to write the extracted object file name into a file.

Can you please let me know how do accomplish this.

Thanks in Advance.
 
Hi,

try this:

$dir=specified_directory
@a_files=<$dir/*.a>;
foreach(@files)
{
system(&quot;ar ..options.. $_&quot;);
#I don't know ar, therefore don't know which options to use
}
$OUTPUT_DIR=..blabla..
@o_files=<$OUTPUT_DIR/*.o>;
#$OUTPUT_DIR is where ar saves those decompressed files;
open(FILE,&quot;>files.txt&quot;);
foreach(@o_files)
{
print FILE $_;
}
close(FILE);

Hope that helps


--
Smash your head on keyboard to continue...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top