Let your AI agent run your Baidu Netdisk.
A fast, scriptable command line for 百度网盘. Claude Code, Codex and any tool-using agent can find, move, transfer and share your files on their own.
English · 简体中文
You: Back up
~/Photos/2026to/Backupon my netdisk, then send me a share link that expires in a week.
$ bdc upload --json ~/Photos/2026 /Backup
{"ok": true, "summary": {"rapid": 37, "uploaded": 212}, "files": [ … ]}
$ bdc share create --json --days 7 /Backup/2026
{"ok": true, "url": "https://pan.baidu.com/s/1AbCdEf?pwd=k7x2", "pwd": "k7x2", … }Agent: Done. 249 photos are in
/Backup/2026; 37 of them were already stored on Baidu and went up instantly. Here's the link: https://pan.baidu.com/s/1AbCdEf?pwd=k7x2 (valid for 7 days).
The agent needs no screen scraping and no guessing. Every command returns one JSON document and an exit code that says what happened.
|
Speaks JSON, never hangs |
Big transfers, done right |
|
Shares, both ways |
You step in only when Baidu insists |
| Platform | How to install |
|---|---|
| macOS | Download the .pkg for your Mac from Releases. It is signed and notarized by Apple. |
| Linux · Windows | Download the archive from Releases and put bdc on your PATH. |
| Go | go install github.com/ac1982/bdc@latest |
Then log in once, with your browser's session:
bdc login --from-chrome # or --from-edge, or paste cookies at the prompt of `bdc login`Add one line to your AGENTS.md or CLAUDE.md:
For Baidu Netdisk, use `bdc --json`.
Read https://github.com/ac1982/bdc/blob/main/llms.txt first.
llms.txt is a short manual written for models: the output format, what each exit code means, and the rules for every command.
Browse ls · tree · meta · search · cd · pwd
Organise mkdir · cp · mv · rm · recycle list|restore|delete
Transfer download · upload · offline add|list|cancel|delete
Share share create|list|cancel|save
Account login · logout · who · users · su · quota
More config · update · an interactive shell (run bdc with no arguments)
bdc <command> --help explains every flag. Human output is in Chinese; the JSON is language-neutral.
Exit codes
| code | error.kind |
meaning |
|---|---|---|
| 0 | done | |
| 1 | failed |
server, network or transfer failure: retry later, transfers resume |
| 2 | input |
not found, already exists, no match, wrong extraction code |
| 3 | dependency |
a permission problem: browser cookies unreadable, or update can't write its directory (use sudo) |
| 4 | auth |
not logged in; with code 132, Baidu wants a security check (run the command in a terminal) |
| 64 | usage |
bad command line, or -y needed without a terminal (logout, recycle delete, update) |
| 130 | cancelled |
interrupted |
Configuration
Settings and accounts live in config.json in the user config directory, or in $BDC_CONFIG_DIR:
- macOS:
~/Library/Application Support/bdc - Linux:
~/.config/bdc - Windows:
%AppData%\bdc
bdc config set changes the save directory, connections, parallel files, speed limits and proxy. bdc never prints your cookies.
Development
go vet ./... && go test -race ./... # unit tests, an in-memory fake Baidu, offline end-to-end replayARCHITECTURE.md maps the code. baidu-api.md documents the web-client protocol bdc speaks.
