Checking file existence using Retrieved Property

(imported topic written by Aristo91)

Hello,

Is there a way to report of file existence ,with Retrieved Property?

i have tried this one:

if ( exists folder “c:tmp” whose (exists file “1.txt” )) then “YES” else “NO”

but it does not work.

Thanks.

(imported comment written by Bill.Ehardt)

exists folder “c:\tmp” whose (exists file “1.txt” of it)

This would be the “error checking” way, as it will check of the folder exists first and will give as true or false.

(imported comment written by jeremylam)

This works too, and won’t give an error if the folder doesn’t exist:

exists file “c:\tmp\1.txt”

(imported comment written by Aristo91)

Hello Wmehardt and Jeremy,

And thanks for your responds.

I added “of it” and it’s still does not work:

if ( exists folder “c:tmp” whose (exists file “1.txt” of it )) then “YES” else “NO”

even though file exists .i recive "NO "

I have also tried this one:

if ( exists file “c:\tmp\1.txt”) then “YES” else “NO” - and it works.