我想上傳新文件在給定的路徑 如果路徑不存在,我想通過創建目錄創建該路徑,然後上傳該文件,如果路徑存在,我只想把我的文件放在該路徑。如何在Google Drive中使用Java找出isFolderExist和isFileExist?
for。例如 '潘多拉'是我的谷歌驅動器上的主文件夾的名稱 我想做它下面的所有目錄和文件操作。
folderPath = /panodra/augusta/weber/
fileName = DEC
在下面的方法我想找出'潘多拉'文件夾,但它返回空項目列表。
private static boolean isFolderExist(String folderPath, String fileName) throws IOException {
Files.List request = drive.files().list().setQ(
"mimeType='application/vnd.google-apps.folder' and trashed=false and title='pandora' ");
FileList files = request.execute();
List<File> fl1 = files.getItems();
System.out.println(fl1);
System.out.println(files);
return false;
}