|
|
发表于 2026-3-29 14:39:34
|
显示全部楼层
本帖最后由 aloha20200628 于 2026-3-29 17:09 编辑
给一个 '一次性备份' bat+powershell 混编版本如下,代码存为 a.bat 运行,若 *.mp4 也要包含子目录中的目标文件,可将代码第5行中的 dir -file *.mp4 改为 dir -r -file *.mp4 即可。
- <# ::
- @echo off &setlocal &cd /d "d:\123"
- powershell -nop -c "iex(${%~f0}|out-string)" &pause&exit/b
- #>
- $t0=get-date; dir -file *.mp4 |%{
- if (($t0 - $_.creationTime).totalSeconds -lt 60) {continue}
- $d='d:\456\'+$_.creationtime.ToString('yyyy-MM-dd'); md -force $d >$null
- copy $_.fullname -des $d -force }
- exit
复制代码 |
|