Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Testing for the Existence of Files (in UNIX) within Perl

Posted on 2005-03-31
Medium Priority
Last Modified: 2010-03-05

I have a number of files sitting on UNIX I'm not interested if a particular one
exists , I just  need to do a file test within my perl script to see if any one of them exists.  All my files are in the same directory /home/myarea/data
and start with extractfile.homesystem   so a file produced today would be
like   /home/myarea/dataextract.homesystem.$todaysdate.data.123456

So  effectively I think I need to use some sort of regular expression
in my perl file test.

All I'm concerned about is the availability
of  any file with a prefix:   dataextract.homesystem.$todaysdate.data

Anything after data. is variable.

Can you help?

Question by:azsat
1 Comment
LVL 85

Accepted Solution

ozo earned 750 total points
ID: 13673430
if( </home/myarea/dataextract.homesystem.$todaysdate.data.*> ){
    print "fille exists\n"

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question