Utilities for organizing files in Google Drive.
- Python 3.8+
- A Google Cloud project with the Drive API enabled
credentials.jsonfrom the Google Cloud Console
pip install -r requirements.txtPlace credentials.json in this directory. On first run, the browser will open for OAuth consent — a token.json is saved afterward for subsequent runs.
Multi-step configurable organizer. All settings are at the top of the file:
| Setting | What it controls |
|---|---|
SOURCE_FOLDER_ID |
Folder to scan |
SEARCH_RECURSIVE |
Scan subfolders |
FILE_TYPE |
image, video, or custom (with CUSTOM_MIME_TYPES) |
MAX_FILES_PER_FOLDER |
Files per destination folder |
FOLDER_PREFIX |
Destination folder name prefix |
DESTINATION_PARENT_FOLDER |
Where to create destination folders |
SORT_BY / SORT_ORDER |
File ordering before assignment |
DRY_RUN |
Safety flag — preview without moving |
SKIP_EXISTING_ORGANIZED_FOLDERS |
Avoid re-scanning organized folders |
SKIP_FOLDERS |
Folder names to exclude during scan |
Discovers existing destination folders (e.g. Photos 001), counts their contents, fills partially full folders first, creates new ones as needed, and skips already-placed files on re-run. Outputs a CSV report with rollback info.
python organizer.pyOriginal single-pass script. Scans a single folder for images, creates Photos 001–Photos NNN, and moves files.
python main.pyRead-only inventory tool. Scans the entire Drive, builds a directory tree, and writes drive_folder_report.csv with file counts and sizes per folder.
python list-files.pyEvery script that moves files writes a move_plan.csv with columns: file_name, file_id, current_folder, target_folder, current_path, target_path, mime_type, size. This doubles as a rollback log — each file can be moved back to its original folder using its file_id and current_path.