Su's Blog

Kratos
专注于用户阅读体验的响应式博客主题
  1. Main page
  2. Uncategorized
  3. Main content

复制备份到usb盘

June 15, 2026 3hotness 0likes 0comments

@echo off
setlocal enabledelayedexpansion

set "SRC=D:\backup"
set "DEST=E:\server_backup"

if not exist "%DEST%" mkdir "%DEST%"

echo ===== Copy backup files (skip existing) =====

REM 复制文件(存在则跳过,不覆盖)
robocopy "%SRC%" "%DEST%" backup_*.zip /XO /R:0 /W:0 >nul

echo ===== Keep only latest 10 files =====

REM 获取文件列表(按时间排序:最新在后面)
set count=0

for /f "delims=" %%F in ('dir "%DEST%\backup_*.zip" /b /o:-d') do (
set /a count+=1
if !count! GTR 10 (
del /f /q "%DEST%\%%F"
)
)

echo Done.
endlocal

Tag: Nothing
Last updated:June 15, 2026

Su

This person is a lazy dog and has left nothing

Like
< Last article

COPYRIGHT © 2024 Su's Blog. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.