Tôi cần thư mục tải lên với thư mục con trên amazon s3. Tôi thử tải lên bằng hình thu nhỏ này.Cách tải thư mục với thư mục con lên amazon s3?
for (Path path : directoryWalk("/home/rmuhamedgaliev/tmp/eota7tas0cdlg2ufq5mlke7olf/")){
if (!path.getParent().toString().equals("eota7tas0cdlg2ufq5mlke7olf")){
amazonS3Client.putObject("*****", "/plans/eota7tas0cdlg2ufq5mlke7olf/" + path.getParent().toString() + "/" + path.getFileName(), new File(path.toString()));
} else {
amazonS3Client.putObject("*******", "/plans/eota7tas0cdlg2ufq5mlke7olf/" + path.getFileName(), new File(path.toString()));
}
}
Nhưng mã này tạo ra các file đường dẫn đầy đủ với ("/ home/rmuhamedgaliev/tmp/eota7tas0cdlg2ufq5mlke7olf"). Làm thế nào để tải lên nó với con đường ("/ kế hoạch/eota7tas0cdlg2ufq5mlke7olf/{thư mục con và các tập tin}")
private List<Path> directoryWalk(String path) throws IOException {
final List<Path> files = new ArrayList<>();
Files.walkFileTree(Paths.get(path), new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
files.add(file);
return FileVisitResult.CONTINUE;
}
});
return files;
}
tôi muốn tải lên tất cả các file mà có mặt trong thư mục duy nhất như giả sử tôi đã tên thư mục "TestMech", trong đó có số lượng ảnh mà tất cả ảnh tôi cần phải tải lên với sự giúp đỡ của chỉ số tiến bộ là nó có thể & làm sao –