루트 디렉토리에서만 파일을 다운로드하려고합니다. 현재 루트가 아닌 다른 폴더에있는 가장 최근의 파일을 다운로드하는 방법을 모르기 때문에 현재 폴더를 지정하고 있지 않습니다. 내가 원한다면 루트에있는 파일 만 있으면됩니다. 파일과 다운로드 URL을 받고있다 코드는 다음과 같습니다 :Google 드라이브 복구 API, 루트 폴더에서만 파일 다운로드
public static void startDownload() throws IOException, ParseException {
Drive serv = getDriveService();
FileList result = serv.files().list().setMaxResults(10).execute(); //there are 10 files in the root folder
List<File> listA = result.getItems();
if (listA == null || listA.isEmpty()) {
System.out.println("No files found.");
} else {
System.out.println("Files:"+lista.size());
for (File file : listA) {
System.out.printf("%s (%s)\n", file.getTitle(), file.getDownloadUrl());
downloadFile(serv, file);
}
}
}
난 단지가 아닌 다른 폴더에 루트 파일에있는 모든 파일을 다운로드하고 싶습니다. 어떤 도움을 주시면 감사하겠습니다.