以文件的创建时间为准-方法1.bat- @echo off
- set "OldFolder=C:\Test\测试\From"
- set "NewFolder=C:\Test\测试\To"
- set "ThisDate=2023/09/05"
- set "ThisTime=16:00"
- for /f "tokens=1-3*" %%a in ('dir /a-d /tc /od "%OldFolder%\*.txt" ^| findstr /i /e /c:".txt"') do (
- if "%%a %%b" gtr "%ThisDate% %ThisTime%" (
- copy "%OldFolder%\%%d" "%NewFolder%"
- ) else (
- goto :eof
- )
- )
复制代码 以文件的创建时间为准-方法2.bat- @echo off
- set "OldFolder=C:\Test\测试\From"
- set "NewFolder=C:\Test\测试\To"
- set "ThisDate=2023/09/05"
- set "ThisTime=16:00"
- powershell "Get-ChildItem -Path '%OldFolder%' -Recurse -ErrorAction:SilentlyContinue | Where-Object {(($_.CreationTime.ToString('yyyy/MM/dd HH:mm') -gt '%ThisDate% %ThisTime%') -and $_.PsISContainer -ne $True)} | ForEach-Object {Copy-Item -Path $_.FullName -Destination '%NewFolder%'}"
复制代码 以文件的修改时间为准-方法1.bat- @echo off
- set "OldFolder=C:\Test\测试\From"
- set "NewFolder=C:\Test\测试\To"
- set "ThisDate=2023/09/05"
- set "ThisTime=16:00"
- for /f "tokens=1-3*" %%a in ('dir /a-d /od "%OldFolder%\*.txt" ^| findstr /i /e /c:".txt"') do (
- if "%%a %%b" gtr "%ThisDate% %ThisTime%" (
- copy "%OldFolder%\%%d" "%NewFolder%"
- ) else (
- goto :eof
- )
- )
复制代码 以文件的修改时间为准-方法2.bat- @echo off
- set "OldFolder=C:\Test\测试\From"
- set "NewFolder=C:\Test\测试\To"
- set "ThisDate=2023/09/05"
- set "ThisTime=16:00"
- powershell "Get-ChildItem -Path '%OldFolder%' -Recurse -ErrorAction:SilentlyContinue | Where-Object {(($_.LastWriteTime.ToString('yyyy/MM/dd HH:mm') -gt '%ThisDate% %ThisTime%') -and $_.PsISContainer -ne $True)} | ForEach-Object {Copy-Item -Path $_.FullName -Destination '%NewFolder%'}"
复制代码
|