drive_sync_folder
Sync a local folder tree to a Google Drive folder by relative paths, creating new files and updating changed ones in place. Defaults to dry-run preview of creates, updates, and skips.
Instructions
Push a local folder tree into a Drive folder, creating or updating by name.
Matches local files to Drive files by their path relative to the sync root: a file that already exists is updated in place at its own id (no duplicate), one that doesn't is created, and one whose content already matches is left alone. Sub-folders are created as needed.
This defaults to a dry run. With dry_run=True (the default)
nothing is written — you get the exact list of creates, updates, and
skips that a real run would perform. Pass dry_run=False to apply it.
Nothing is ever deleted from Drive: files present in Drive but absent
locally are left untouched.
local_path is a directory on the machine running this server.
drive_folder is a Drive folder id or path from My Drive root;
create_destination makes a missing destination path (default False).
exclude is a list of glob patterns relative to the sync root — e.g.
["drafts/*", "*.tmp"]. A pattern ending in / excludes a
directory and everything under it at any depth. These are added to a
built-in list that always excludes private/, .git/, .env,
key/certificate files, and credential JSON; that built-in list cannot be
switched off by any argument. Malformed patterns abort the whole sync
rather than silently matching nothing, and every excluded file is listed
in skipped so an exclusion is never invisible.
The sync refuses to run at all — in dry run or for real — if any local
file maps onto two same-named Drive files, or onto a Google-native Doc/
Sheet/Slide that a text upload would flatten. Those appear in
collisions and native_conflicts for you to resolve by hand.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| exclude | No | ||
| local_path | Yes | ||
| drive_folder | Yes | ||
| create_destination | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||