Var tmpFileExt: String; tmpFileWE: String; Begin psExitCode:= 0; // ... add your code here tmpFileExt := ExtractFileExt(psFilename); tmpFileWE := psStringReplace(psFilename, tmpFileExt, ''); psLogWrite(1, '', 'Filename without Ext: ' + tmpFileWE); // Check IF FileExists(psFilePath + tmpFileWE + '.xml') And FileExists(psFilePath + tmpFileWE + '.usf') And FileExists(psFilePath + tmpFileWE + '.jpg') Then psExitCode := 1 Else psLogWrite(1, '', 'Waiting on files in ' + psfilePath); End.