Initial commit: U盘备份工具 (Udisk Backup Tool for Windows)

Windows GUI tool to backup USB drives with full mirror sync,
hash-based incremental skip, robust copy and failure logging.
This commit is contained in:
SamBuuuu committed 2026-08-14 16:45:52 +08:00
commit 3909f100d0
5 files changed
+706

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
# U盘备份工具 (Udisk Backup)
一款 Windows 平台的开源 U 盘备份工具,带图形界面(GUI),支持全量镜像备份与增量复制。
## 功能特性
- 🖥️ **图形界面** — 基于 tkinter,无需命令行操作
- 💾 **自动检测 U 盘** — 枚举可移动磁盘,可选包含固定磁盘(读卡器/USB 硬盘)
- 🔄 **全量镜像备份** — 目标目录与 U 盘完全一致,自动清理源中已删除的文件
- ⚡ **增量跳过** — 通过 SHA-256 哈希对比,未变化的文件秒跳过
- 🛡️ **健壮复制** — 自动清除只读属性、重试复制、1MB 缓冲大文件复制
- 📋 **失败记录** — 复制失败的文件完整记录,不静默跳过
- ⏹️ **可取消** — 备份过程中随时中止
- 🚫 **系统目录豁免** — 自动跳过 `System Volume Information`、`$RECYCLE.BIN` 等系统目录
- 📁 **长路径支持** — 处理 Windows 长路径限制
## 使用方法
### 直接运行(需要 Python 3.8+)
```bash
python usb_backup.py
```
无需第三方依赖(仅标准库:tkinter / ctypes / hashlib)。
### 打包为 exe(可选)
```bash
pip install pyinstaller
pyinstaller --onefile --windowed --icon icon.ico usb_backup.py
```
打包产物在 `dist/U盘备份工具.exe`,可分发到无 Python 环境的 Windows 机器。
> 预编译的 exe 请从 [Releases](../../releases) 下载。
## 备份位置
默认备份到 `E:\U盘备份`,按 U 盘卷标自动建子目录。
## 目录结构
```
├── usb_backup.py # 主程序(单文件,~600 行)
├── icon.ico # 程序图标
└── README.md
```
## 许可证
[MIT](LICENSE)