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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 84

Accepted Solution

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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

771 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