FTP 服务器挂载成本地磁盘盘符

📅 2026/7/19 1:07:55 👁️ 阅读次数 📝 编程学习
FTP 服务器挂载成本地磁盘盘符

为把ftp路径像本地盘一样读写,可以把 FTP 服务器挂载成本地磁盘盘符(比如Z)。

常用工具有:FTPUSE、RaiDrive、rclone等;

工具 FTPUSE RaiDrive rclone
特点 Windows简单FTP映射,功能有限不稳定 Windows图形化工具,一键安装配置;无网环境安装复杂 跨平台命令行,强大的VFS缓存,配置复杂效率高

rclone

  1. 虚拟磁盘驱动WinFsp
    确保已经安装WinFsp,否则rclone mount会失败。
  2. 最新稳定版rclone(v1.74.4.0,x64)
    rclone.exe放到C:\Windows\System32即可。

rclone.conf

相关配置都存在在rclone.conf,存放路径可通过指令查看:

rclone config file

image

n → 新建远程
image

名称:myftp(自定义,如 nas、server)
image

存储类型:选18, ftp(FTP)
image

host:内网 IP(如 192.168.1.100)
image

user:服务器用户名
image

port:默认 21,Enter即可
image

pass:输入密码(或用密钥)
后面的高级选项:一路回车默认
image

Mount_Ftp.vbs

Mount_Ftp.vbs放到后台启动(shell:startup),双击可以启动ftp挂载Z盘。

Set ws = CreateObject("WScript.Shell")
ws.Run "rclone mount premap: Z: --network-mode --vfs-cache-mode full --cache-dir ""D:\rclone_cache"" --vfs-cache-max-size 1G --vfs-cache-max-age 24h --buffer-size 128M --transfers 4 --checkers 8 --no-modtime --attr-timeout 30s --dir-cache-time 1h --timeout 60s --contimeout 30s --volname ""FTP"" --links", 0
Set ws = Nothing

Unmount.bat

可以使用脚本,一键取消挂载。

@echo off
taskkill /f /im rclone.exepause

test.bat

可以使用脚本进行测试,查看挂载过程。


@echo off
taskkill /f /im rclone.exe >nul 2>nul
timeout /t 2 /nobreak >nulrclone mount premap: Z: ^
--network-mode ^
--vfs-cache-mode full ^
--cache-dir "D:\rclone_cache" ^
--vfs-cache-max-size 1G ^
--vfs-cache-max-age 24h ^
--buffer-size 128M ^
--transfers 4 ^
--checkers 8 ^
--no-modtime ^
--attr-timeout 30s ^
--dir-cache-time 1h ^
--timeout 60s ^
--contimeout 30s ^
--volname "FTP" ^
--links pause
exit

rclone copy

rclone mount,用来浏览、打开小文件(< 50MB)、轻度使用;
大量文件拷贝,大文件、批量操作等,可以用rclone copy等操作;

chcp 65001set srcDir=myftp:/subdir/test
set dstDir=D:/tmprclone copy "%%srcDir%%" "%%dstDir%%" --progress --transfers 4 --buffer-size 128M ^
--ftp-disable-utf8 --local-encoding=None:: 2. 批量把 GBK 乱码 → UTF‑8 正常中文(rclone v1.70+ 支持)
rclone convmv "%%dstDir%%" ^--name-transform decoder=gbk ^--name-transform encoder=utf-8 ^--dry-runpause