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

  • SEARCH
  • Home
  • 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 8867329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:00:00+00:00 2026-06-14T17:00:00+00:00

I have to get a file from a PDF files directory. I have problem

  • 0

I have to get a file from a PDF files directory. I have problem that I haven’t a field to concant all data to find the file.

Here’s an example:

File name:

Comp_20120619_170310_2_632128_FC_A_8_23903.pdf

File name generate:

Comp_20120619_--------_2_632128_FC_A_8_23903.pdf

I dont’ have the field "--------" to make file COMPLETE name.

I’m trying with File.list but I cannot find the correct 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-14T17:00:01+00:00Added an answer on June 14, 2026 at 5:00 pm

    You can define a FilenameFilter to match against the filenames, and return true if the filename matches what you’re looking for.

        File dir = new File("/path/to/pdfs");
        File[] files = dir.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                return name.matches("Comp_20120619_[^_]*_2_632128_FC_A_8_23903.pdf");
            }
        });
    

    The listFiles() method returns an array of File objects. This makes sense, because there might be more than one file that matches the pattern (in theory at least, albeit not necessarily in your system).

    I’ve used a regular expression to match the filename, using [^_]* to match the section you’re not sure about. However, you can use any function that will return a boolean if the filename matches. For example, you could use startsWith and endsWith instead of a regular expression.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one problem , I want to get some data from XML file
I want to get the file names of all files that have a specific
So I have a plist structured string, that get dynamically (not from the file
I have been using fop 0.95 to generate pdf files from xml data. I
I have a PDF file with valuable textual information. The problem is that I
I have an application that serves artifacts from files (pages from PDF files as
I have written simple code to get content from xml file to php. $xml
Im attempting to get a block of text from a file I have already
I have a bit of PHP code that grabs a list of files from
I have been successful with extracting text from a PDF file using GhostScript along

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.