[英]Powershell, Get-ChildItem from today only
What's the best way to grab files from today only in Powershell? 仅在Powershell中从今天开始抓取文件的最佳方法是什么? I have this:
我有这个:
$file_list = gci $foldern | where {([datetime]::now - $_.lastwritetime).TotalHours -lt 24};
But it grabs files from the last 24 hours, and not quite "today". 但是它会从最近的24小时内抓取文件,而不是“今天”。
为什么不只检查日期?
$file_list = gci $foldern | where {([datetime]::now.Date -eq $_.lastwritetime.Date)};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.