file-exists Questions

8

I have a case where file_exists() is always returning false. My latest attempt was to just test to see if it would return true for $_SERVER["SCRIPT_FILENAME"] and then return the value of the path ...
Gatekeeper asked 25/11, 2009 at 19:59

4

I was expecting Path('') to be a path that does not exist because it does not correspond to a file or directory name. Why is this considered to exist? from pathlib import Path print(Path('').exis...
Nappie asked 13/7, 2018 at 17:38

5

Solved

I need to check the current directory and see if a file with an extension exists. My setup will (usually) only have one file with this extension. I need to check if that file exists, and if it does...
Doubletalk asked 28/10, 2015 at 20:9

41

How do I check whether a file exists or not, without using the try statement?
Influential asked 17/9, 2008 at 12:55

2

Solved

Like the title says, I would like to make a dependency only if a certain file does not exist, NOT every time it updates. I have a root directory (the one with the makefile) and in it a sub-directo...
Tunicle asked 13/2, 2014 at 5:14

17

How can I check if a file exists using Lua?
Maculation asked 14/2, 2011 at 10:18

19

Solved

How can I check whether a file exists, before opening it for reading in Java (the equivalent of Perl's -e $filename)? The only similar question on SO deals with writing the file and was thus a...
Vamp asked 29/11, 2009 at 20:32

10

Solved

I have this code. It is supposed to check if a file exists and open it if it does. It does work if the file exists, and if it doesn't, however, whenever I leave the textbox blank and click the subm...
Cyrille asked 3/5, 2013 at 3:43

3

Solved

I have seen several similar questions, but no answer worked in my situation, except that it probably has something to do with permissions. A PHP script served by Apache tells me unable to open dat...
Remarkable asked 15/10, 2015 at 11:23

3

Solved

I'm trying to rename the file name of an image when it's uploaded if it exists, say if my file name is test.jpg and it already exists I want to rename it as test1.jpg and then test2.jpg and so on. ...
Kreitman asked 21/4, 2013 at 21:43

6

Solved

I would like to check if a given directory exists. I know how to do this on Windows: BOOL DirectoryExists(LPCTSTR szPath) { DWORD dwAttrib = GetFileAttributes(szPath); return (dwAttrib != INVA...
Demp asked 7/8, 2013 at 9:47

3

Solved

Hello so I am using slim framework and twig, and here is my current code in php: $filename = '/path/to/foo.txt'; if (file_exists($filename)) { echo "The file $filename exists"; } else { echo "Th...
Quinlan asked 16/7, 2015 at 0:55

2

Solved

Based on the MSDN documentation of File.Exists, the File.Exists method should return false on any error, including the caller not having access to read the file. I would expect it to return false...
Odelsting asked 20/1, 2016 at 1:32

7

Solved

if (!(file_exists(http://example.com/images/thumbnail_1286954822.jpg))) { $filefound = '0'; } why won't this work?
Mich asked 23/11, 2010 at 6:55

2

Solved

I am reading in several *.csv, where the names and paths are determined at runtime. However sometimes there are files with do not exist. For this file I need kind of exception handling. Current...
Localism asked 5/1, 2014 at 13:29

3

Solved

How to check that file exists inside a zip archive? For example, check whether app.apk contains classes.dex. I want to find a solution that uses Java NIO.2 Path and without extracting the whole arc...
Articular asked 7/9, 2015 at 10:3

4

Solved

I want to check if a given String is a file or a directory, i've tried the methods isFile() and isDirectory() of the File class but the problem is that if the directory or file doesn't exist these ...
Diacetylmorphine asked 27/12, 2011 at 20:8

8

Solved

I need to check if a particular file exists on a remote server. Using is_file() and file_exists() doesn't work. Any ideas how to do this quickly and easily?
Venge asked 7/10, 2011 at 8:32

12

Solved

I have a script where I want to check if a file exists in a bucket and if it doesn't then create one. I tried using os.path.exists(file_path) where file_path = "/gs/testbucket", but I got...
Stylograph asked 23/11, 2012 at 8:39

20

Solved

When displaying images on our website, we check if the file exists with a call to file_exists(). We fall back to a dummy image if the file was missing. However, profiling has shown that this is th...
Tamis asked 10/11, 2009 at 15:23

6

Is there a way to have a case sensitive Directory.Exists / File.Existssince Directory.Exists(folderPath) and Directory.Exists(folderPath.ToLower()) both return true? Most of the time it does...
Guenther asked 24/4, 2013 at 5:8

3

Solved

I wish there was a File.ExistsAsync() I have: bool exists = await Task.Run(() => File.Exists(fileName)); Using a thread for this feels like an antipattern. Is there a cleaner way?
Buzzard asked 29/9, 2013 at 9:55

4

Solved

I'm looking for an elegant way in Vimscript to check if a file exists in the current directory. I came up with the code below but I'm not sure if that's the most elegant solution (I'll set a Vim o...
Schlock asked 23/6, 2010 at 2:24

5

Solved

This is my code which I am using to verify, URL exists or not on Server, but always getting not exist however link is alive Where I am doing mistake in my code, why I am always getting "doesnot ex...
Fachini asked 17/10, 2014 at 5:34

4

Solved

In my CMake script I want to see if I have a file on my system, and if it is there do something with it, otherwise do something with a default file. Here is the code: find_file( ${project_name}_$...
Jesher asked 25/10, 2012 at 11:17

© 2022 - 2024 — McMap. All rights reserved.