se usi qualcosa tipo così? te lo scrivo in c#, non so se è questo che intendevi

if (File.Exist("path")) //il file esiste