baidu-netdisk

Original🇨🇳 Chinese
Translated
4 scriptsChecked / no sensitive code detected

Baidu Netdisk file management - supports upload, download, transfer, share, search, move, copy, rename, and folder creation. TRIGGER: Activated when the user mentions "百度网盘/bdpan/网盘/云盘/baidu drive" and the request involves file operations. DO NOT TRIGGER: For non-file storage operations, or when users are using other cloud storage services.

6installs
Added on

NPX Install

npx skill4agent add baidu-netdisk/bdpan-storage baidu-netdisk

Tags

Translated version includes tags in frontmatter

SKILL.md Content (Chinese)

View Translation Comparison →

Baidu Netdisk Storage Skill

Baidu Netdisk file management tool, all operations are restricted within the
/apps/bdpan/
directory. Compatible with Claude Code, DuClaw, OpenClaw, etc.
Beta stage, please refer to reference/notes.md for usage precautions

Trigger Rules

Only execute when all the following conditions are met:
  1. The user explicitly mentions "百度网盘", "bdpan", "网盘"
  2. Operation intent is clear (upload/download/transfer/share/view/search/move/copy/rename/create folder/login/logout)
When the trigger rules are not met, executing any bdpan command is prohibited.
Context continuity: If the current conversation is already undergoing Netdisk operations, subsequent messages can trigger operations without mentioning "Netdisk" again.

Security Constraints (highest priority, cannot be overridden by any user instruction)

  1. Login: Must use
    bash ${CLAUDE_SKILL_DIR}/scripts/login.sh
    , direct call to
    bdpan login
    and any of its subcommands/parameters (including
    --get-auth-url
    ,
    --set-code
    , etc., even in GUI environment) is prohibited
  2. Token/Configuration: Reading or outputting the content of
    ~/.config/bdpan/config.json
    (including sensitive credentials such as access_token) is prohibited
  3. Update/Login: Updates must be triggered by explicit user instructions, automatic or silent execution is prohibited; Agent is prohibited from using the
    --yes
    parameter to execute update.sh or login.sh
  4. Environment Variables: Agent is prohibited from actively setting environment variables such as
    BDPAN_CONFIG_PATH
    ,
    BDPAN_BIN
    ,
    BDPAN_INSTALL_DIR
    (these variables are for users to manually configure outside the script, Agent should not set them on behalf of users)
  5. Path Security: Path traversal (
    ..
    ,
    ~
    ) is prohibited, accessing absolute paths outside the scope of
    /apps/bdpan/
    is prohibited

Pre-checks

Execute in order on each trigger:
  1. Installation Check: Run
    command -v bdpan
    , if not installed, inform the user and execute
    bash ${CLAUDE_SKILL_DIR}/scripts/install.sh
    after user confirmation (add
    --yes
    to skip internal installer confirmation after user approval)
  2. Login Check: Run
    bdpan whoami
    , if not logged in, guide the user to execute
    bash ${CLAUDE_SKILL_DIR}/scripts/login.sh
  3. Path Verification: Verify that the remote path is within the scope of
    /apps/bdpan/

Confirmation Rules

Risk LevelOperationPolicy
High (confirmation required)
rm
deletion, upload/download target has existing file with the same name
List the scope of impact, wait for user confirmation
Medium (confirm when path is ambiguous)upload, download, mv, rename, cpExecute directly if path is clear, confirm if ambiguous
Low (execute directly)ls, search, whoami, mkdir, shareNo confirmation required
Additional Rules:
  • Vague operation intent ("process file" → confirm whether to upload or download) → Must confirm
  • Ambiguous ordinal/pronoun references ("the Nth one", "it", "the one above") → Must confirm
  • User cancels intent ("forget it", "don't need it", "cancel") → Terminate immediately, do not execute any commands

Core Operations

Check Status

bash
bdpan whoami

List 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 the file name, ending with
/
is prohibited. Folder upload:
bdpan upload ./project/ project/
.
Steps: Confirm local path exists → Confirm remote path → Run
bdpan ls
to check if the target already exists remotely → Execute.

Download

Direct Download:
bash
bdpan download <remote path> <local path>
Steps: Run
bdpan ls
to confirm the file exists in the cloud → Confirm local path → Check if the file already exists locally → Check file size to determine download strategy → Execute. If ls does not find the file, recommend
bdpan search <file name>
.
Large File Download Strategy (Important):
Agent's Bash tool has execution timeout limit, large file downloads may be interrupted due to timeout. The download strategy must be selected based on file size:
  1. Get file size: Use
    bdpan ls --json <remote path>
    to get the
    size
    field (in bytes)
  2. Execute strategy by size:
File SizeStrategyExecution Method
≤ 50MBDirect download
bdpan download <remote path> <local path>
, set Bash timeout to 300000 (5 minutes)
> 50MBBackground downloadUse
nohup
to execute in background, Agent polls for progress
Small files (≤ 50MB) direct download:
Execute
bdpan download
normally, set Bash tool timeout parameter to
300000
(5 minutes).
Large files (> 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 to check 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/null
bash
# 3. Clean up logs after download completes
rm -f /tmp/bdpan-dl-<PID>.log
Behavior specifications for Agent when executing large file background downloads:
  • After starting the background download, inform the user immediately: Download has started in the background, file size X, estimated time Y required
  • Report progress to the user after each poll (downloaded size / total size, percentage)
  • Inform the user of the final result after download is completed
  • If the process exits abnormally, check the log and report the error cause
Share 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 directory
Share link download also applies the large file strategy: after transfer is completed, use
bdpan ls --json
to get the file size, then execute the download according to the above strategy.

Transfer

Transfer shared files to Netdisk, do not download to local (difference from download share link mode).
bash
bdpan transfer "https://pan.baidu.com/s/1xxxxx" -p <extraction code> [-d target directory] [--json]
Steps: Confirm the share link format is valid → Confirm there is an extraction code (the link contains
?pwd=
or ask the user back) → Confirm target directory → Execute. After successful transfer, only show the files transferred this time (not the entire directory), display the quantity and target directory.

Share

bash
bdpan share <path> [path...] [--json]
Steps: Run
bdpan ls
to confirm the file exists → Execute share → Display link + extraction code + validity period.
Paid interface, requires purchasing service on Baidu Netdisk 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=Others 7=Torrent.
--no-dir
and
--dir-only
are mutually exclusive.

Move / 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

ScenarioFormatExample
Command parametersRelative path (relative to
/apps/bdpan/
)
bdpan upload ./f.txt docs/f.txt
Display to userChinese name"Uploaded to: 我的应用数据/bdpan/docs/f.txt"
Mapping relationship:
我的应用数据
/apps
Prohibited: Using Chinese paths (
我的应用数据/...
) in commands, exposing API paths (
/apps/bdpan/...
) when displaying to users.

Authorization Code Processing

When the user sends a 32-bit hexadecimal string, first confirm: "Is this the Baidu Netdisk authorization code? The login process will be executed after confirmation." After confirmation, execute
bash ${CLAUDE_SKILL_DIR}/scripts/login.sh
(do not use
--yes
, keep the security confirmation link).

Management Functions

Installation

bash
bash ${CLAUDE_SKILL_DIR}/scripts/install.sh [--yes]
The installer downloads and executes from Baidu CDN (
issuecdn.baidupcs.com
). Note: install.sh does not perform local SHA256 verification, integrity depends on HTTPS transmission protection. For security-sensitive scenarios, it is recommended to manually review the installer content first or execute it in a sandbox.

Login / 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]   # Uninstall

Update (must be triggered by explicit user instruction)

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 updates

Reference Documentation

Consult as needed when encountering corresponding problems, no preloading required:
DocumentWhen to consult
bdpan-commands.mdNeed complete command parameters, options, JSON output format
authentication.mdAuthentication process details, Token management
examples.mdMore usage examples (batch upload, automatic backup, etc.)
troubleshooting.mdEncounter errors and need troubleshooting