Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7733253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:56:25+00:00 2026-06-01T06:56:25+00:00

I am working on a project that pulls files from a third party FTP

  • 0

I am working on a project that pulls files from a third party FTP site where the files are defined by a mask, lets say ‘XXX’MMddy.FILE where XXX is the vendor code and y is the last digit of the year.

My application is only concerned with the files matching the mask, but does not care about the actual date on the file. Currently, we are building a list of dates a month back with the Java Calendar object and iterating through it to create each possible mask until one matches or is determined invalid. I feel like there should be a better way to do this…

So to reiterate, in a consise question, is there a way to use the mask without creating an instance of each date to compare to the actual filename?

i.e. XXX04022.FILE conforms to XXXMMddy.FILE

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:56:26+00:00Added an answer on June 1, 2026 at 6:56 am

    You could implement a FilenameFilter to use on File.listFiles:

    public class YourFilenameFilter extends java.io.FilenameFilter
    {
        public boolean accept(java.io.File file, String name)
        {
            boolean shouldAccept = false;
            if(name!=null)
            {
                java.util.regex.Pattern p = java.util.regex.Pattern.compile("[A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][0-9][0-9].FILE");
                java.util.regex.Matcher m = p.matcher(name);
                if(m.matches()) {
                    shouldAccept = true;
                }
            }
            return shouldAccept;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a project that pulls data out of an xml files
I'm working on project that lets users choose some scientific authors and columnists and
I´m working on a project that basically will show some data collected from hardware
I am working on a project right now that has to separate project files.
I'm going to need to push and pull files from a SharePoint site that
We have several config files in a project that 3 people are working on.
I have a tested and working php script that pulls from a db and
I am working a project that does not have a trunk / branches /
Working on a project that parses a log of events, and then updates a
Im working on a project that has an implementation of JOSSO in place. We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.