file-exists


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

安稳与你 提交于 2020-02-25 10:16:05
问题 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 <not> syntax isn’t supported: <profile> <id>create-test-mysql-props-file</id> <activation> <file> <not><exists>${basedir}/src/main/myfile</exists></not> </file> </activation> <build> <plugins> <!-- Generate mysql datasource properties --> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <version>1.0-alpha

Fastest way to redirect missing image files

烂漫一生 提交于 2020-01-07 04:12:25
问题 I have an on-the-fly thumbnailing system and am trying to find the best way to make sure it's as fast as possible when serving up images. Here is the current flow: User requests thumbnail thumbnails/this-is-the-image-name.gif?w=200&h=100&c=true htaccess file uses modrewrite to send requests from this folder to a PHP file PHP file checks file_exists() for the requested image based on the query string values If it does: header('content-type: image/jpeg'); echo file_get_contents($file_check_path

node.js - check if file exists before creating temp file

守給你的承諾、 提交于 2020-01-05 09:33:55
问题 I want to create a temporary file/directory in node.js. To do this, I'm attempting a simple algorithm: Generate a file name based on pid, time, and random chars Check if file exists if yes: return to step 1 and repeat if not: create the file and return it Here's the problem: The node.js documentation for fs.exists explicitly states that fs.exists should not be used, and instead one should just use fs.open and catch a potential error: http://nodejs.org/docs/latest/api/fs.html#fs_fs_exists_path

checking if file exists in a specific directory

不问归期 提交于 2020-01-01 07:35:21
问题 I am trying to check for a specific file in a given directory. I don't want the code but I want to fix the one I have. The only difference in this question, is that I look for files with an extension .MOD . I have the code ready:- public static int checkExists(String directory, String file) { File dir = new File(directory); File[] dir_contents = dir.listFiles(); String temp = file + ".MOD"; boolean check = new File(temp).exists(); System.out.println("Check"+check); // -->always says false for

VBScript to move file with wildcard, if it exists

人盡茶涼 提交于 2019-12-30 10:59:08
问题 I am attempting to create a script that checks for the existence of archived eventlog files and, if any files exist, moves them to another folder. Running this script does nothing and gives no errors. I believe the wildcard in the If statement is what is giving me issues. I am new to vbscript, and scripting in general, and would appreciate some advice. Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists("d:\eventlogs\Archive*.evtx")) Then FSO.CopyFile "d:\eventlogs\Archive

Checking a file existence on a remote SSH server using Python

三世轮回 提交于 2019-12-30 06:29:09
问题 I have two servers A and B. I'm suppose to send, let said an image file, from server A to another server B. But before server A could send the file over I would like to check if a similar file exist in server B. I try using os.path.exists() and it does not work. print os.path.exists('ubuntu@serverB.com:b.jpeg') The result return a false even I have put an exact file on server B. I'm not sure whether is it my syntax error or is there any better solution to this problem. Thank you 回答1: The os

Check if a file exists with Lua

北战南征 提交于 2019-12-28 11:46:22
问题 How can I check if a file exists using Lua? 回答1: Try function file_exists(name) local f=io.open(name,"r") if f~=nil then io.close(f) return true else return false end end but note that this code only tests whether the file can be opened for reading. 回答2: Using plain Lua, the best you can do is see if a file can be opened for read, as per LHF. This is almost always good enough. But if you want more, load the Lua POSIX library and check if posix.stat( path ) returns non- nil . 回答3: I will quote

Adding a value to the end of a file if it's duplicate in php yii

家住魔仙堡 提交于 2019-12-25 18:14:27
问题 I am trying to handle duplicate filenames. if a user uploads a file name called "file" then another user uploads a file called "file" I want to be able to add a 1 to the new file so it would be now called "1file". I am able to do this but my issue is when someone uploades "file" for a third time it overrides "1file" I need the 1 to increase. I am using The yii framework Here is my function in my controller: function actionIndex(){ //$dir = Yii::getPathOfAlias('application.images'); //$dir is

Unable to set as Ringtone because file already exists

喜夏-厌秋 提交于 2019-12-25 07:59:22
问题 I am trying to make app with set as ringtone feature but I got a problem. When I Set as ringtone once it's working. But when I try to set as ringtone for second time, nothing happens. Now the problem is because file already exist. How can I set my code to like...If file already exist proceed to next step Here is my code: private File rsound; private final File rpath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES); private void s1ring() { Boolean success =

PHP file_exists directory

谁都会走 提交于 2019-12-24 12:48:34
问题 I am trying to use file exists in a subdirectory and running into some problems with the directory structure or perhaps something else. This code was working earlier when called from the main directory The file that includes the command is in a subdirectory that is one directory below the main directory of the domain. When I call the following on a file that I know exists nothing is returned, neither FALSE nor TRUE $imgpath1 = 'pics/'.$userid.'_pic.jpg'; $exists = file_exists($imgpath1); echo

工具导航Map