myspacee Posted October 21, 2008 Share Posted October 21, 2008 (edited) Hello to all, read help to use fileexist function, here example : If FileExists("C:\autoexec.bat") Then MsgBox(4096, "C:\autoexec.bat File", "Exists") Else MsgBox(4096,"C:\autoexec.bat File", "Does NOT exists") EndIf i'm trying to put in one line, to manage no existence case : if filenotexist then do endif search in forum but can't find an easy example to learn this 'simple' condition. anyone can help me? m. Edited October 21, 2008 by myspacee Link to comment Share on other sites More sharing options...
bluerein Posted October 21, 2008 Share Posted October 21, 2008 try If No FileExists("C:\autoexec.bat") Then Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 21, 2008 Share Posted October 21, 2008 If Not FileExists("C:\autoexec.bat") Then MsgBox(4096, "C:\autoexec.bat File", "Does NOT exists") If FileExists("C:\autoexec.bat") = 0 Then MsgBox(4096, "C:\autoexec.bat File", "Does NOT exists") Both should work. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
myspacee Posted October 21, 2008 Author Share Posted October 21, 2008 thank you for code, m. Link to comment Share on other sites More sharing options...
LimeSeed Posted October 21, 2008 Share Posted October 21, 2008 (edited) if fileexists($file) then msgbox(0, "File", "File Exists!") else msgbox(0, "File", "File Doesn't Exist!") endif just wondering why you don't just use this? its the easiest way and probably most efficient? this is probably the best way to do it Edited October 21, 2008 by LimeSeed global $warming = true Link to comment Share on other sites More sharing options...
myspacee Posted October 21, 2008 Author Share Posted October 21, 2008 if fileexists($file) then msgbox(0, "File", "File Exists!") else msgbox(0, "File", "File Doesn't Exist!") endif just wondering why you don't just use this? its the easiest way and probably most efficient? this is probably the best way to do it Not for my task. This is part of my production code: if StringRight(StringReplace($file_no_ext, ".bmp", ""), 2) <> "01" and Not FileExists($sDir & "\" & StringReplace($file, StringRight($file, 6), "") & "01.bmp") then do elseif .... simple way often isn't best way. Bye and thank you all. m. Kerry 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now