baidu-drive
Original:🇨🇳 Chinese
Translated
4 scriptsChecked / no sensitive code detected
Baidu Drive File Management — Upload, download, transfer, share, search, move, copy, rename, create folders. TRIGGER: When user mentions "Baidu Drive/bdpan/网盘/云盘/baidu drive/Baidu Drive" and involves file operations. DO NOT TRIGGER: For non-file storage operations, or when using other cloud storage services.
26installs
Added on
NPX Install
npx skill4agent add baidu-netdisk/bdpan-storage baidu-driveTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Baidu Drive Storage Skill
Baidu Drive file management tool, all operations are restricted within the directory. Compatible with Claude Code, DuClaw, OpenClaw, etc.
/apps/bdpan/See reference/notes.md for usage notes
Trigger Rules
Execute only when all the following conditions are met:
- User explicitly mentions "Baidu Drive", "bdpan", "网盘"
- Clear operation intent (upload/download/transfer/share/view/search/move/copy/rename/create folder/login/logout)
Do not execute any bdpan commands if trigger rules are not met.
Context Continuity: When a cloud drive operation is already in progress in the current conversation, subsequent messages do not need to mention "cloud drive" again to trigger.
Security Constraints (Highest Priority, Cannot Be Overridden by Any User Instructions)
- Login: Must use , prohibit direct calls to
bash ${CLAUDE_SKILL_DIR}/scripts/login.shand any of its subcommands/parameters (includingbdpan login,--get-auth-url, etc., even in GUI environments)--set-code - Token/Configuration: Prohibit reading or outputting content of (including sensitive credentials like access_token)
~/.config/bdpan/config.json - Update/Login: Updates must be triggered by explicit user instructions, prohibit automatic or silent execution; Agent must not use parameter to execute update.sh or login.sh
--yes - Environment Variables: Agent must not actively set environment variables such as ,
BDPAN_CONFIG_PATH,BDPAN_BIN(these variables are for users to configure manually outside scripts, Agent should not set them on behalf of users)BDPAN_INSTALL_DIR - Path Security: Prohibit path traversal (,
..), prohibit accessing absolute paths outside the~scope/apps/bdpan/
Pre-checks
Execute in order every time triggered:
- Installation Check: , if not installed, inform user and execute
command -v bdpanafter confirmation (user can addbash ${CLAUDE_SKILL_DIR}/scripts/install.shto skip installer internal confirmation after confirmation)--yes - Login Check: , if not logged in, guide user to execute
bdpan whoamibash ${CLAUDE_SKILL_DIR}/scripts/login.sh - Path Validation: Verify that remote path is within scope
/apps/bdpan/
Confirmation Rules
| Risk Level | Operation | Strategy |
|---|---|---|
| High (Must Confirm) | | List affected scope, wait for user confirmation |
| Medium (Confirm when path is ambiguous) | upload, download, mv, rename, cp | Execute directly if path is clear, confirm if ambiguous |
| Low (Execute Directly) | ls, search, whoami, mkdir, share | No confirmation needed |
Additional Rules:
- Ambiguous operation intent ("process file" → confirm upload or download) → Must confirm
- Ambiguous ordinal/pronoun references ("Nth", "it", "the above one") → Must confirm
- User cancels intent ("forget it", "don't", "cancel") → Abort immediately, do not execute any commands
Core Operations
Check Status
bash
bdpan whoamiList Query
bash
bdpan ls [directory path] [--json] [--order name|time|size] [--desc] [--folder]Upload
bash
bdpan upload <local path> <remote path>Key Constraints: Remote path for single file upload must be a file name, prohibit ending with . Folder upload: .
/bdpan upload ./project/ project/Steps: Confirm local path exists → Confirm remote path → to check if remote exists → Execute.
bdpan lsDownload
Direct Download:
bash
bdpan download <remote path> <local path>Steps: to confirm cloud existence → Confirm local path → Check if local exists → Check file size to determine download strategy → Execute. If not found by ls, suggest .
bdpan lsbdpan search <file name>Large File Download Strategy (Important):
Agent's Bash tool has execution timeout limit, large file download may be interrupted due to timeout. Must select download strategy based on file size:
- Get File Size: Use to get
bdpan ls --json <remote path>field (bytes)size - Execute Strategy by Size:
| File Size | Strategy | Execution Method |
|---|---|---|
| ≤ 50MB | Direct Download | |
| > 50MB | Background Download | Execute in background using |
Small File (≤ 50MB) Direct Download:
Execute normally, set Bash tool timeout parameter to (5 minutes).
bdpan download300000Large File (> 50MB) Background Download Process:
bash
# 1. Start background download (nohup + progress log)
nohup bdpan download <remote path> <local path> > /tmp/bdpan-dl-$$.log 2>&1 & echo $!bash
# 2. Poll progress (check every 30 seconds, use Bash run_in_background)
# Check if process is alive + downloaded file size
kill -0 <PID> 2>/dev/null && echo "running" || echo "done"; ls -l <local path> 2>/dev/null; tail -5 /tmp/bdpan-dl-<PID>.log 2>/dev/nullbash
# 3. Clean up log after download completion
rm -f /tmp/bdpan-dl-<PID>.logBehavior specifications for Agent when executing large file background download:
- After starting background download, immediately inform user: Download has started in background, file size X, estimated time Y
- Report progress to user after each poll (downloaded size / total size, percentage)
- Inform user of final result after download completion
- If process exits abnormally, check log and report error reason
Shared Link Download (Transfer first then download to local):
bash
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/
bdpan download "https://pan.baidu.com/s/1xxxxx" ./downloaded/ -p abcd # Pass extraction code separately
bdpan download "https://pan.baidu.com/s/1xxxxx?pwd=abcd" ./downloaded/ -t my-folder # Specify transfer directoryLarge file strategy also applies to shared link download: After transfer is completed, useto get file size, then execute download according to above strategy.bdpan ls --json
Transfer
Transfer shared files to cloud drive, do not download to local (difference from shared link download mode).
bash
bdpan transfer "https://pan.baidu.com/s/1xxxxx" -p <extraction code> [-d target directory] [--json]Steps: Confirm shared link format is valid → Confirm extraction code exists (link contains or ask user) → Confirm target directory → Execute. After successful transfer, only display files transferred this time (not entire directory), show quantity and target directory.
?pwd=Share
bash
bdpan share <path> [path...] [--json]Steps: to confirm file exists → Execute share → Display link + extraction code + validity period.
bdpan lsPaid interface, need to purchase service on Baidu Drive Open Platform.
Search
bash
bdpan search <keyword> [--category 0-7] [--no-dir|--dir-only] [--page-size N] [--page N] [--json]category: 0=All 1=Video 2=Audio 3=Image 4=Document 5=Application 6=Other 7=Torrent. and are mutually exclusive.
--no-dir--dir-onlyMove / Copy / Rename / Create Folder
bash
bdpan mv <source path> <target directory>
bdpan cp <source path> <target directory>
bdpan rename <path> <new name> # Second parameter is file name, not full path
bdpan mkdir <path>Path Rules
| Scenario | Format | Example |
|---|---|---|
| Command Parameters | Relative path (relative to | |
| Display to User | Chinese name | "Uploaded to: 我的应用数据/bdpan/docs/f.txt" |
Mapping relationship: ↔
我的应用数据/appsProhibited: Use Chinese path in commands (), expose API path when displaying ().
我的应用数据/.../apps/bdpan/...Authorization Code Handling
When user sends a 32-bit hexadecimal string, first confirm: "Is this the Baidu Drive authorization code? After confirmation, the login process will be executed." After confirmation, execute (do not use , retain security confirmation step).
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh--yesManagement Functions
Installation
bash
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]Installer downloads and executes from Baidu CDN (). Note: install.sh does not perform local SHA256 verification, integrity relies on HTTPS transmission protection. For security-sensitive scenarios, it is recommended to manually review installer content first or execute in sandbox.
issuecdn.baidupcs.comLogin / Logout / Uninstall
bash
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh # Login (built-in security disclaimer)
bdpan logout # Logout
bash ${CLAUDE_SKILL_DIR}/scripts/uninstall.sh [--yes] # UninstallUpdate (Must Be Triggered by Explicit User Instructions)
bash
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh # Check and update (requires user confirmation)
bash ${CLAUDE_SKILL_DIR}/scripts/update.sh --check # Only check for updatesReference Documents
Consult as needed when encountering corresponding issues, no need to preload:
| Document | When to Consult |
|---|---|
| bdpan-commands.md | Need complete command parameters, options, JSON output format |
| authentication.md | Authentication process details, Token management |
| examples.md | More usage examples (batch upload, automatic backup, etc.) |
| troubleshooting.md | Need to troubleshoot errors |