同步软件介绍


freefilesync.org_

FreeFileSync 是一款文件夹比较与同步软件,可用于创建并管理所有重要文件的备份副本。不同于每次都复制全部文件,FreeFileSync 会先识别源文件夹与目标文件夹之间的差异,仅传输完成同步所需的最小数据量。

FreeFileSync 属于开源软件,支持在 Windows、macOS 和 Linux 三种操作系统上运行。

对比手动复制粘贴的优点:

  • 仅传输完成同步所需的最小数据量,传输速度大大提升

  • 智能识别差异

    • image
  • 支持冲突显示

使用教程

FreeFileSync简明教程:强大的文件同步软件FreeFileSync使用说明+功能演示【图文】参考链接教程

方案实践


效果演示


查看视频地址:

实践

比如,当你使用一个u盘来存上班的东西,下班时带回家,插入电脑将进行自动同步更新

新建运行同步.bat

@echo off
chcp 936 >nul 2>nul

:: targetLabel改成你对应的盘符名
set "targetLabel=便携"
set "found=0"
set "foundDrive="

:: 遍历所有盘符
for %%d in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
    if exist "%%d:\" (
        for /f "delims=" %%v in ('vol %%d: 2^>nul') do (
            set "line=%%v"
            setlocal enabledelayedexpansion
            :: 提取卷标
            if "!line:卷是=!" neq "!line!" (
                set "label=!line:*卷是 =!"
                set "label=!label: =!"  :: 去除空格
                echo 调试:%%d: 提取的卷标是【!label!】
                :: 匹配成功时,直接跳出所有循环
                if "!label!"=="%targetLabel%" (
                    endlocal
                    set "found=1"
                    set "foundDrive=%%d:"
                    goto :foundDevice  :: 强制跳出循环
                )
            )
            endlocal
        )
    )
)

:foundDevice
if %found% equ 1 (
    echo 检测到设备“%targetLabel%”(盘符:%foundDrive%),执行命令...
    echo.
    :: 用 start 命令并行启动两个程序 这边需要指向你的同步任务
    start "" "C:\Users\zxb\Desktop\同步\同步Project.ffs_gui"
    start "" "C:\Users\zxb\Desktop\同步\同步学习资料.ffs_gui"
    echo.
    echo 两个程序已同时启动!
) else (
    echo 未检测到设备“%targetLabel%”
)

exit /b

  • 按下【Win】键,搜索“任务计划程序”

image

  • 打开任务计划程序,创建任务

image

  • image
  • image
  • image
  • image
  • image
  • image