@Test @Tag("S3Test") public void testListFilesInFolder() { Resource[] files = handler.listFilesInFolder(BUCKET_NAME, "_unittest/forListFiles", "*"); assertThat(files).filteredOn(Resource::isReadable) .extracting(Resource::getFilename) .hasSize(3) .contains("_unittest/forListFiles/dummyfile.txt") .contains("_unittest/forListFiles/testfile") .contains("_unittest/forListFiles/テストファイル.CSV"); }
public Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern) { var s3FolderUrl = "s3: var searchPath = s3FolderUrl + "/" + filePattern; try { return resolver.getResources(searchPath); } catch (IOException e) { throw new RuntimeException(e); } }
S3FileHandler { public Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern) { var s3FolderUrl = "s3: var searchPath = s3FolderUrl + "/" + filePattern; try { return resolver.getResources(searchPath); } catch (IOException e) { throw new RuntimeException(e); } } }
S3FileHandler { public Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern) { var s3FolderUrl = "s3: var searchPath = s3FolderUrl + "/" + filePattern; try { return resolver.getResources(searchPath); } catch (IOException e) { throw new RuntimeException(e); } } S3FileHandler(AmazonS3 amazonS3, ApplicationContext context); }
S3FileHandler { public Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern) { var s3FolderUrl = "s3: var searchPath = s3FolderUrl + "/" + filePattern; try { return resolver.getResources(searchPath); } catch (IOException e) { throw new RuntimeException(e); } } S3FileHandler(AmazonS3 amazonS3, ApplicationContext context); Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern); void deleteFile(String bucketName, String filePath); void copyFile(String fromBucketName, String fromFilePath, String toBucketName, String toFilePath); Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix); void deleteAllFilesInFolder(String bucketName, String folderPath); void deleteAllFilesInFolderExcept(String bucketName, String folderPath, List<String> excludeList); }
S3FileHandler { public Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern) { var s3FolderUrl = "s3: var searchPath = s3FolderUrl + "/" + filePattern; try { return resolver.getResources(searchPath); } catch (IOException e) { throw new RuntimeException(e); } } S3FileHandler(AmazonS3 amazonS3, ApplicationContext context); Resource[] listFilesInFolder(String bucketName, String folderPath, String filePattern); void deleteFile(String bucketName, String filePath); void copyFile(String fromBucketName, String fromFilePath, String toBucketName, String toFilePath); Resource moveFileToWorkFolder(String bucketName, String filePath, String folderName, String workFolderSuffix); void deleteAllFilesInFolder(String bucketName, String folderPath); void deleteAllFilesInFolderExcept(String bucketName, String folderPath, List<String> excludeList);  }