Understøt download af hele biblioteket hvis FOLDERS_TO_DOWNLOAD er tom

This commit is contained in:
Martin Tranberg
2026-03-26 10:51:46 +01:00
parent f67cfc22ee
commit aea5ff68c0
3 changed files with 11 additions and 3 deletions

View File

@@ -139,6 +139,10 @@ def main():
local_path_base = config.get('LOCAL_PATH', '').replace('\\', os.sep)
folders_to_download = [f.strip() for f in folders_to_download_str.split(',') if f.strip()]
# If no folders specified, download everything from root
if not folders_to_download:
folders_to_download = [""] # Empty string represents root folder
print(f"Connecting via Graph API (with auto-refresh and skip logic)...")
@@ -154,7 +158,11 @@ def main():
drive_id = get_drive_id(app, site_id, drive_name)
for folder in folders_to_download:
print(f"\nProcessing folder: {folder}")
if folder == "":
print("\nProcessing entire document library (Root)...")
else:
print(f"\nProcessing folder: {folder}")
local_folder_path = os.path.join(local_path_base, folder)
download_folder_recursive(app, drive_id, folder, local_folder_path, report)