我将制作一个 SWAG,并认为您想要识别当月编写的文件,但创建时间早于上次编写它们的时间。这么近吗?
将所有四 (4) 个文件放在同一目录中。这假设如果创建时间和上次写入时间之间的差异小于一 (1) 秒,则表示没有修订。
=== revs.bat
@powershell -NoLogo -NoProfile -File "%~dp0revs.ps1"
=== revs.ps1
$RevDir = 'C:\Users\nlehman\Desktop\New folder (3)'
$CloseEnough = New-Timespan -Seconds 1
Get-ChildItem -File -Recurse -Path $RevDir |
Where-Object {
($_.LastWriteTime -ge (Get-Date (Get-Date) -day 1 -hour 0 -minute 0 -second 0)) -and
(($_.LastWriteTime - $_.CreationTime) -gt $CloseEnough)
}
=== revsnot.bat
@powershell -NoLogo -NoProfile -File "%~dp0revsnot.ps1"
=== revsnot.ps1
$RevDir = 'C:\Users\nlehman\Desktop\New folder (3)'
$CloseEnough = New-Timespan -Seconds 1
Get-ChildItem -File -Recurse -Path $RevDir |
Where-object {
($_.LastWriteTime -ge (Get-Date (Get-Date) -day 1 -hour 0 -minute 0 -second 0)) -and
(($_.LastWriteTime - $_.CreationTime) -lt $CloseEnough)
}