人在外面也能叫龍蝦傳檔案給你!
1人在外面 - 不在電腦旁邊,但需要主機上的檔案
2LINE 限制 - LINE 無法直接傳送某些格式的檔案
3自動備份 - 讓龍蝦定期把重要檔案備份到雲端
在 PowerShell(系統管理員)執行:
# 方法一:用 winget 安裝(推薦) winget install Rclone.Rclone # 方法二:用 Chocolatey 安裝 choco install rclone # 方法三:用 Scoop 安裝 scoop install rclone
安裝完成後,確認版本:
rclone version
rclone v1.73.0(或更新版本)
在 PowerShell 輸入:
rclone config
你會看到這個畫面:
No remotes found, make a new one? n) New remote s) Set configuration password q) Quit config n/s/q>
1輸入 n(New remote)然後按 Enter
2輸入名稱:gdrive 然後按 Enter
在 Storage 選單中,找到 Google Drive:
Option Storage. Type of storage to configure. ... 23 / Google Cloud Storage (this is not Google Drive) \ (google cloud storage) 24 / Google Drive <-- 找這個! \ (drive) 25 / Google Photos \ (google photos) ... Storage>
3輸入 24(或 drive)然後按 Enter
接下來會問你幾個問題,大部分直接按 Enter 用預設值:
Option client_id. Google Application Client Id Enter a value. Press Enter to leave empty. client_id>
4client_id → 直接按 Enter(留空)
5client_secret → 直接按 Enter(留空)
6scope → 輸入 1(Full access)
7root_folder_id → 直接按 Enter(留空)
8service_account_file → 直接按 Enter(留空)
Edit advanced config? y) Yes n) No (default) y/n>
9Edit advanced config? → 輸入 n
Use auto config? y) Yes (default) n) No y/n>
10Use auto config? → 看情況選擇:
• 在電腦前有瀏覽器:輸入 y(會自動開瀏覽器登入)
• 遠端/無瀏覽器:輸入 n(會給你一個網址,用手機登入)
瀏覽器會自動打開 Google 登入頁面,登入後按「允許」。
你會看到一個網址:
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=... Enter verification code>
11用手機或電腦打開那個網址
12登入 Google 帳號,按「允許」
13複製授權碼,貼回 PowerShell 按 Enter
Configure this as a Shared Drive (Team Drive)? y) Yes n) No (default) y/n>
14Shared Drive? → 輸入 n(除非你要用共用雲端硬碟)
最後確認設定:
Configuration complete.
Options:
- type: drive
- scope: drive
- token: {"access_token":"..."}
Keep this "gdrive" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d>
15輸入 y 確認,然後輸入 q 退出
測試上傳一個檔案:
# 上傳單一檔案到根目錄 rclone copy "C:\Users\user\test.txt" gdrive: # 上傳到指定資料夾 rclone copy "C:\Users\user\test.txt" gdrive:OpenClaw-Uploads # 上傳整個資料夾 rclone copy "C:\Users\user\Documents\MyFolder" gdrive:MyFolder
查看雲端檔案:
# 列出雲端根目錄 rclone ls gdrive: # 列出指定資料夾 rclone ls gdrive:OpenClaw-Uploads
建立 gdrive-upload.ps1 腳本:
# gdrive-upload.ps1
# 上傳檔案到 Google Drive 並產生分享連結
param(
[Parameter(Mandatory=$true)]
[string]$FilePath,
[string]$RemoteFolder = "OpenClaw-Uploads"
)
$fileName = Split-Path $FilePath -Leaf
# 上傳檔案
Write-Host "正在上傳 $fileName ..." -ForegroundColor Cyan
rclone copy $FilePath "gdrive:$RemoteFolder"
if ($LASTEXITCODE -eq 0) {
Write-Host "上傳成功!" -ForegroundColor Green
# 產生分享連結
$link = rclone link "gdrive:$RemoteFolder/$fileName"
Write-Host "分享連結:$link" -ForegroundColor Yellow
# 複製到剪貼簿
$link | Set-Clipboard
Write-Host "(已複製到剪貼簿)" -ForegroundColor Gray
} else {
Write-Host "上傳失敗!" -ForegroundColor Red
}
把 disk-audit.zip 上傳到我的 Google Drive
龍蝦會執行上傳,然後回覆你分享連結。
# 上傳檔案 & "$env:USERPROFILE\.openclaw\workspace\gdrive-upload.ps1" -FilePath "C:\path\to\file.zip" # 上傳到指定資料夾 & "$env:USERPROFILE\.openclaw\workspace\gdrive-upload.ps1" -FilePath "C:\file.zip" -RemoteFolder "Backups"
# 上傳 rclone copy "C:\file.zip" gdrive:OpenClaw-Uploads # 產生連結 rclone link "gdrive:OpenClaw-Uploads/file.zip"
| 你想做的事 | 指令 |
|---|---|
| 上傳檔案 | rclone copy 本地路徑 gdrive:遠端路徑 |
| 下載檔案 | rclone copy gdrive:遠端路徑 本地路徑 |
| 同步資料夾 | rclone sync 本地 gdrive:遠端 |
| 列出檔案 | rclone ls gdrive:資料夾 |
| 產生分享連結 | rclone link gdrive:檔案路徑 |
| 刪除檔案 | rclone delete gdrive:檔案路徑 |
| 查看設定 | rclone config |
現在龍蝦可以幫你上傳檔案到 Google Drive 了!
rclone config 設定 Google Drive