Page 1 of 1

Checking the file if it is already exist in a specific loc.

Posted: Sun Feb 09, 2014 2:42 am
by snop21
Hello everyone,

Can I ask how to check if the file is already exist in a location.

Any help will be very much appreciated

Thank you..

-snop21

Re: Checking the file if it is already exist in a specific l

Posted: Sun Feb 09, 2014 2:47 am
by FourthWorld

Code: Select all

if there is a file tMyFilePath then
   DoSomething
else
   answer "The file "& quote& tMyFilePath &quote&" cannot be found."
end if
Yep, there is a "there is" operator. Welcome to LiveCode. :)

Re: Checking the file if it is already exist in a specific l

Posted: Sun Feb 09, 2014 7:34 am
by snop21
-- FourthWorld

Thank you for welcoming me here..! I am new in livecode..! I really find it interesting!.. :))

if there is a ----> file <--- tMyFilePath then
DoSomething
else
answer "The file "& quote& tMyFilePath &quote&" cannot be found."
end if

I have a followup question the file word there is the name of the file that I am referring to?

Many Thanks..

-snop21

Re: Checking the file if it is already exist in a specific l

Posted: Sun Feb 09, 2014 7:55 am
by Simon
Hi snop21,
put "C:\Users\snop21\Documents\theFile.txt" into tMyFilePath

Now does Richard's code make sense?

Simon