Questions tagged [file-exists]

A "FileExists" method provides a mechanism to determine if a specified path/file exists.

Overview

FileExist methods, which are available in most languages, typically have a path/filename parameter and return a Boolean value, indicating whether the file exists.

Implementations

The following links provide reference to the method descriptions for various languages:

606 questions
5
votes
4 answers

How to properly use Coldfusion's FileExist() method?

I don't use coldfusion much at all, I'm needed to patch up some code though. Basically I'm trying to check and see if a file I uploaded exist and if it does exist, increment a variable by 1. Then repeat untill I get a unique file name. For…
d.lanza38
  • 2,525
  • 7
  • 30
  • 52
5
votes
2 answers

use php read file on network with ip or computername

When i use php read file on LAN network through ip or computer name. $url = "\\\\192.168.0.200\\testshare\\1.txt"; if(file_exists($url) == TRUE) { echo "OK"; } else { echo "Error"; } result: always…
hungtran
  • 51
  • 1
  • 1
  • 2
4
votes
4 answers

Exception Thrown in C# for FileStream Constructor with CreateNew for Existing File

I am creating a file in C# (.NET Web Service) and do not want to overwrite an existing file. The way seems to be to construct a FileStream with FileMode.CreateNew set. It does in fact throw an exception if the file exists. But how do I recognize…
dkeisen
  • 73
  • 6
4
votes
1 answer

How can I in ant wait until a file is usable?

I'm trying to fix a build file where a part of it runs a bash script to generate a file. This file generation takes under a second and wasn't a problem until we moved to eclipse. The issue is that if I save any file in eclipse with a change and then…
Ólafur Waage
  • 68,817
  • 22
  • 142
  • 198
4
votes
3 answers

Check if image exists on remote server before downloading

Im trying to download images from remote server, resize and then save it local machine. To do this I use a WideImage.
jamjam
  • 51
  • 1
  • 3
4
votes
5 answers

Conditional IF EXIST Statement for multiple filenames in BATCH file

I'm working on the following batch script and I'm not sure how I can achieve the results I'm looking for. I searched here as well as online, but I didn't see anything that looked like what I'm looking for. Any help is appreciated. I need to check…
4
votes
1 answer

How to check file `name` (with any extension) does exist in the directory in Golang?

I know I could check the file does exist or not in Golang by the answers of the following questions. How to check whether a file or directory denoted by a path exists in Golang? How to check if a file exists in Go? Gist - Check if file or directory…
Yami Odymel
  • 1,782
  • 3
  • 22
  • 48
4
votes
2 answers

VBS FileSystem Object - FileExists, comparing more than just the filename

I have a script that periodically downloads information from an RSS feed, one of which being an image. Right now, I'm checking to see if the image exists before I download it using the FileSystemObject and the FileExists comparison so that I'm not…
Jonny
  • 65
  • 11
4
votes
7 answers

file_exists() isn't finding the file

if(file_exists("./squadra/photos/photog.jpg")) { echo "### YES ###"; } else { echo "### NO ###"; } if i run this function on /zones/team.php it works (it print YES). If i run this function on /auth/ajax.php it print NO. Why? EDIT So i make…
markzzz
  • 47,390
  • 120
  • 299
  • 507
4
votes
3 answers

PHP and file_exists - clarification of a note on the documentation

I was checking the documentation for the file_exists() PHP function. The documentation at some point reads: The check is done using the real UID/GID instead of the effective one. What does that mean? I have no idea. Can somebody please explain…
Daniele
  • 99
  • 3
4
votes
1 answer

How do I activate a Maven profile if a file does NOT exist?

I’m using Maven 3.2.3. How do I activate a profile if a file does NOT exist on the file system? I have tried the below, but discovered that the syntax isn’t supported:
Dave A
  • 2,780
  • 9
  • 41
  • 60
4
votes
3 answers

PHP doesn't recognize filename with apostrophe in it

Currently I am trying to check with PHP if a file exists. The current file I am trying to check if it exists has an apostrophe in it, the file is called:13067-AP-03 A - Situation projetée.pdf. The code I use to check if the file exist is: $filename…
Quartermain
  • 163
  • 3
  • 17
4
votes
1 answer

File.exists() returns false for existing file

I am trying to check if a file exists in my user's Download directory. File imageFile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),imageName); if(imageFile.exists()) // Do something else // Do…
Dan Eckhart
  • 245
  • 2
  • 8
4
votes
2 answers

check if file with certain file extension present in folder using batch script

I want to check a certain file extension in the folder using batch script Its like, if exist do something else do something else Here file name may be anything but only extension(.elf) is important
Manas Mohanta
  • 65
  • 1
  • 1
  • 4
4
votes
1 answer

Check if file exists on parent directory (from root) is impossible?

I was wondering why I can't check if file exists on parent directory (not from root and not from upper directories) if(file_exists('../1.txt')) { echo 'File Exists!'; } else { echo 'File Is Not Exists!'; } Or is it impossible to check if…
davidmarko
  • 343
  • 3
  • 17