file-exists

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

Don't display a button while file exists on server

夙愿已清 提交于 2019-12-24 08:28:40
问题 I'm trying to display a download button on an HTML page only when a specific file on the web server is deleted. I thought I'd use a CSS display: none; then a PHP script with a while loop that'd look like this : while (file_exists("/aaa/file.txt")) { sleep(5); } //set display property of the invisibleLink class to block and continue The thing is I don't know how to do this last step and every thread I've seen about modifying CSS with PHP doesn't work with my use case. 回答1: PHP executes before

Redirecting image requests via .htaccess depending on file existence

狂风中的少年 提交于 2019-12-24 03:16:43
问题 I implemented an image generator which saves the final file in . jpg format inside /images . Once the file is saved, there is no need to generate it ever again . This is the route for the image generator: /gen.php?id=495abc This is the directory where all the . jpg images are saved: /images/495abc.jpg So, the objective is: If a user tries to request http://website.com/images/495abc.jpg , the .htaccess rules have to verify if the file exists and then execute one of two actions depending on the

PHP:is_file() and file_exists() return different results on same file

谁说胖子不能爱 提交于 2019-12-23 16:02:35
问题 I am having an issue where file_exists returns false and is_file returns true. echo(getmygid()." = gid\n"); //501 echo(getmyuid()." = uid\n"); //501 echo(posix_getgid()." = pgid\n"); //501 echo(posix_getuid()." = puid\n"); //501 var_dump(file_exists("/home/www/public_html/")); //bool(true) var_dump(file_exists("/home/www/public_html/index.html")); //bool(false) var_dump(is_file("/home/www/public_html/index.html")); //bool(true) var_dump(stat("/home/www/public_html/index.php")); The output is:

Case sensitive Directory.Exists / File.Exists

梦想与她 提交于 2019-12-23 07:16:16
问题 Is there a way to have a case sensitive Directory.Exists / File.Exists since Directory.Exists(folderPath) and Directory.Exists(folderPath.ToLower()) both return true ? Most of the time it doesn't matter but I'm using a macro which seems not to work if the path doesn't match cases 100%. 回答1: Since Directory.Exists uses FindFirstFile which is not case-sensitive, no. But you can PInvoke FindFirstFileEx with an additionalFlags parameter set to FIND_FIRST_EX_CASE_SENSITIVE 回答2: Based on the