-
1. Re: Is there a way to know if a file REALLY exists?
Steve Bishop Feb 27, 2013 7:07 AM (in response to jjcarneiro)Possibly you could do it in an Execute Script step using methods available on the Java File object.
-
2. Re: Is there a way to know if a file REALLY exists?
jjcarneiro Feb 27, 2013 8:37 AM (in response to Steve Bishop)Hi Steve,
That is exactly what I ended up doing.
For future reference here is the script code I used, seems to do the job:
File filename =pathToFile( patExecContext.getProcessDataStringValue("/process_data/@filepath"));
boolean doesFileReallyExists = filename.canWrite();
if (doesFileReallyExists ) {
try {
ran = new RandomAccessFile(filename , "rw");
try {
if (ran != null) ran.close();
} catch (IOException ioe) {
}
} catch (Exception ex) {
doesFileReallyExists = false;
}
}
patExecContext.setProcessDataBooleanValue("/process_data/@fileExists", doesFileReallyExists );
One caveat of that script is that LCES needs R/W access to the file/document.
hth
julio

