Jump to content

Recommended Posts

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
Posted

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

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...