} else {
toListDirectory = shellOperation.getFirstParameter();
}
File toListDirectoryFile = buildAbsolutePath(currentDirectory, toListDirectory);
if (!toListDirectoryFile.exists()) {
return new StringCommandResponse(FOLDER_TO_LIST_NOT_FOUND_MESSAGE + toListDirectory);
}
// Build toListDirectory absolute path
// List the files
String[] content = toListDirectoryFile.list();
String lsResult = "";
for (int i = 0; i < content.length; i++) {
lsResult += buildFileInfo(content[i], toListDirectory);
if (i < content.length - 1) {
lsResult += LINE_SEPARATOR;
}
}
return new StringCommandResponse(lsResult);
}