powershell - 根据创建时间搜索文件

标签 powershell

我有一个相机,每小时拍摄一张照片,记录正在 build 的建筑物。

这一年每天生成 24 张图片并将它们存储在一个文件夹中。

动画的夜间图片太多,所以我想删除在 xx/xx/xxxx 08:00 AM - xx/xx/xxxx 05:00 PM 之间创建的图片 .

使用 Powershell 或 CMD,我想按创建时间搜索文件,其中日期是通配符(任何日期)。

最佳答案

试一试。更改过滤器通配符以匹配您的图像扩展名。文件将移至 c:\NightPictures 文件夹。

Get-ChildItem c:\pictures -Filter *.jpg | 
Where-Object {$_.CreationTime.Hour -gt 8 -and $_.CreationTime.Hour -lt 17} |
Move-Item -Destination c:\NightPictures

关于powershell - 根据创建时间搜索文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13969631/

相关文章:

powershell - 将具有动态元素数量的数组传递到Powershell中的Start-Job中

powershell - 在 PowerShell 中使用 Move-Item 将主机名和日期附加到文件名

powershell - Powershell:检查网络驱动器是否存在,如果不存在,请映射它,然后仔细检查

powershell - 重命名多个文件夹(有错误!)

powershell - PowerShell ISE:如何运行新的PowerShell版本

具有单参数构造函数的 PowerShell 类不验证数据类型

powershell - 在 Get-AzureSqlDatabaseserver、Azure、PowerShell、Variable 之后添加一列

powershell - 命令未找到异常 : get-windowsoptionalfeature

performance - 读取CSV文件时Powershell拦截并修复特定值

javascript - 如何在 powershell 中比较两个 .js 文件