Can we check if a csv file is present in a shared folder using Katalon?

Can we check if a csv file is present in a shared folder using Katalon?

yes. you want a pure java solution, a groovy solution or a bash script? katalon himself don’t have such keyword, but you can use your (or ours) imagination

You can try something like this:
@Keyword
public boolean verifyFileWithinInDirectory(String directory, String file) {
File dir = new File(directory);
File[] dirContents = dir.listFiles();
String lastAttempt = ‘’;
if (dirContents.length > 0) {
for (int i = 0; i < dirContents.length; i++) {
if (dirContents[i].getName().equals(file)) {
KeywordUtil.markPassed('The file : ’ + file + ’ exists in: ’ + directory)
return true;
}
lastAttempt = dirContents[i].getName().equals(file);
}
if (lastAttempt != file) {
throw new StepFailedException('The file : ’ + file + ’ does not exist in: ’ + directory)
return false;
}
}
return false;
}

after that you can call that method and verify:

CustomKeywords.‘project.classNameWhereMethodIs.verifyFileWithinInDirectory’(“Z:\directory1\directory2\”, “testFile.csv”)Preformatted text