可能需要映射,论坛内搜索自行解决...同一文件如果备份后再修改,需等到次日再备份
- @echo off
- rem 保存为ansi
- cd /d "%~dp0"
- rem 源目录
- set f1=d:\a
- rem 映射目录
- set f2=
- rem time.log 文件不可丢失。初次修改时间为 2024/08/02 00:00
- (set /p t=<"time.log") 2>nul || set t=2024/08/02 00:00
- attrib +a /s "%f1%\*"
- for /f "delims=" %%i in ('dir /b /s /a-d "%f1%"') do (
- if "%%~ti" lss "%t%" (
- attrib -a "%%i"
- )
- )
- for /f "tokens=1-5" %%a in ('powershell -c "'{0:yyyy MM dd hh mm}' -f (get-date)"') do (
- robocopy "%f1%" "%f2%\%%a\%%b\%%c" /s /a /xc /xn /xo
- >"time.log" echo %%a/%%b/%%c %%d:%%e
- )
- attrib +a /s "%f1%\*"
- pause
复制代码
|