Find Files Named with 'text.rpt' in All Directories and Subdirectories using Perl
Hi,
I want to write a script in Perl that can create an array of filename named 'text.rpt'. The files are in subdirectories. Below are the files' path: /localdisk/user/aaa/aa1/a11/text.rpt /localdisk/user/bbb/ba1/b11/text.rpt /localdisk/user/ccc/ca1/c11/text.rpt Below is the code that I tried but I don't think it is right because it set the directory to tmp. I don't want the script to specify which subdirectory it should look. I want the script to look into all directories and subdirectories because the summary files are tool generated. Code:
#!/usr/bin/env perl |
This code will search for the file test.rpt from the /home directory to all subdirectory... Hope this is what you were looking for
Quote:
|
Hi,
Thanks for your reply. But I don't think the script display the filename "text.rpt" Instead, it prints all the pathname of directories, subdirectories and file. |
Updated
I've found a simpler script that will work. Code:
use strict; Thank you. |
It's okay.
I've figured out it already :) |
Good work, Hope you are not considering the cases i considered.
What if the directory is a symbolic link ? will your find will traverse in those directory ? If you will not encounter symbolic links then the solution seems Okay ! |
Quote:
How did you actually implement this? -- Rick |
Quote:
Below is my code Code:
# find files named "summary.rpt" |
Quote:
-- Rick |
How do I open each file without listing the files' location manually?
|
All times are GMT -5. The time now is 07:46 PM. |