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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:35:56+00:00 2026-06-11T07:35:56+00:00

in php we can check if file exist using if(file_exists(destination/)) { condition } but

  • 0

in php we can check if file exist using

if(file_exists("destination/"))
{
    condition
}

but what I wanted to do is…

for example I already have this file on my destination

hello_this_is_filename(2).doc

how would I know if there is a file in that directory having a name containing a character

hello_this_is_filename

I wanted to search that way because… if there is exists on that directory, what will I do is… renaming the file into

hello_this_is_filename(3).doc

I also need to count the existence of my search so I know what number I’m going to put like

(3), (4), (5) and so on

any help?

  • 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-11T07:35:57+00:00Added an answer on June 11, 2026 at 7:35 am

    Use glob.

    if (count(glob("destination/hello_this_is_filename*.doc"))) {
      //...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using for loop in PHP can we have numbers associate with a variable name?
how to make php can read log file in /var/log/.... I tried this code
I am currently using the php file_exist method to check if an image exist
How can I check if a specific file exists on a remote server using
Hello guys i have a problem streaming PDF files with php, i'm using this
Possible Duplicate: How can one check to see if a remote file exists using
How can I check a string in php for specific characters such as '#'
How can I check for duplicate email addresses in PHP , with the possibility
Is their any way can I check in PHP that my brower(s) FF/Chrome/IE/Safari popup
How can a PHP script check if a value is in an array? 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.