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 8165129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:28:01+00:00 2026-06-06T19:28:01+00:00

At a specific folder in the system there is a file. I know that

  • 0

At a specific folder in the system there is a file.
I know that its name is a number, and I have that number in a variable.

What i don’t know is what extension this file has.

How do i scoop up this 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-06T19:28:02+00:00Added an answer on June 6, 2026 at 7:28 pm
    (my $filename) = glob "$specific_folder_in_the_system/$that_number.*";
    

    EDIT: As Ikegami notes below, this is sensitive to the particular pathname of the directory. It will fail if that directory name contains spaces or other special characters. You can mitigate that by wrapping the non-wildcard portion of the string in embedded quotation marks:

    (my $filename) = glob "'$specific_folder_in_the_system/$that_number.'*";
    

    But that will still fail for e.g. $specific_folder_in_the_system = "/Users/O'Neal, Patrick";.

    If you don’t mind changing your current working directory, you can chdir($specific_folder_in_the_system) or die first and then use just glob("$that_number.*"), which should be safe as long as $that_number is really a number.

    You could also use a combination of opendirand grep in lieu of glob:

    opendir(my $dir, $specific_folder_in_the_system) or die;
    (my $filename) = grep /^$that_number\./ readdir $dir;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder that will contain a temporary file that will be created
I want to check if a specific apk is present in system app folder.
I know how to revert to a specific revision of a folder using these
I used this code to access the Specific XML under the SharePoint Mapped Folder;
What specific techniques have you found to learn keyboard shortcuts while programming? I don't
i have a simple program that sorts a text file according to length of
I have a webserver from where users can download files that are specific for
I have a large html file that I want to split apart. I have
Is there a maximum lengh for a file extension? The longest one I've seen
I'm creating a temp image always named 1.png under specific folder and once i

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.