Sign in to follow this  
Followers 0
myspacee

file not exists

6 posts in this topic

#1 ·  Posted (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 by myspacee

Share this post


Link to post
Share on other sites



try

If No FileExists("C:\autoexec.bat") Then

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

thank you for code,

m.

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by LimeSeed

global $warming = true

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0