我创建了一个批处理文件,用于将数据从本地共享驱动器复制到我的桌面,但工作正常,但我的问题是它复制了所有数据,其中我只想复制那些修改日期等于今天的文件。
@echo off
title WAIT !
Set "sourceDir=\\172.16.10.55\echuser\data"
Set "destinationFolder="C:\Users\ishu.bhardwaj\Desktop\New folder
Set "_report=C:\Users\ishu.bhardwaj\Desktop\New folder"
IF NOT EXIST "%sourceDir%" (echo.Could not find %sourceDir% &GoTo:done)
:: overwrite previous log
>"%_report%" (
echo.%date% - %time%
echo.---------------------------------------------------
echo.
)
:: copy files
For /F "Delims=" %%! in ('Dir "%sourceDir%\" /b /s /a-d 2^>nul') do (
@echo.%%! &(
@xcopy "%%!" "%destinationFolder%\" /i /y /h /f /c >>"%_report%",2>&1)
)
:done
title,Done.......
echo.&pause>nul
此致 Ishu Bhardwaj
答案 0 :(得分:0)
我通过网络搜索得到了答案:
@ECHO OFF
FOR /F "tokens=2 delims= " %%V IN ("%DATE%") DO SET TDY=%%V
xcopy /y "\\172.16.10.55\echuser\data\*.*" "C:\Users\ishu.bhardwaj\Desktop\Reports\SQL\CLI Dump\*.*" /d:%TDY%
SET TDY=
此致 Ishu Bhardwaj