[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
查询F:\test盘,90天之前产生的文件。
  1. powershell -c "Get-ChildItem -Path 'f:\test' -Recurse -ErrorAction:SilentlyContinue | Where-Object -FilterScript {(((get-date) - ($_.LastWriteTime)).days -gt 90 -and $_.PsISContainer -ne $True)} | Select-Object FullName"
复制代码
查询F:\test盘,所有修改日期在2021-03-25(包含)之后的所有文件。
  1. PowerShell "Get-ChildItem -Path 'F:\test' -Force -Recurse -ea SilentlyContinue | ?{$_.LastWriteTime.ToString('yyyy-MM-dd') -ge '2021-03-25' -and $_.PsISContainer -ne $True} | select FullName"
复制代码
查询F:\test盘,所有修改日期在2021-03-25(包含)之前的所有文件。
  1. PowerShell "Get-ChildItem -Path 'F:\test' -Force -Recurse -ea SilentlyContinue | ?{$_.LastWriteTime.ToString('yyyy-MM-dd') -le '2021-03-25' -and $_.PsISContainer -ne $True} | select FullName"
复制代码
查询F:\test盘,所有修改日期在2021-03-25 仅当天的所有文件。
  1. PowerShell "Get-ChildItem -Path 'F:\test' -Force -Recurse -ea SilentlyContinue | ?{$_.LastWriteTime.ToString('yyyy-MM-dd') -eq '2021-03-25' -and $_.PsISContainer -ne $True} | select FullName"
复制代码
最后的操作,自已参考下面改。
Select-Object FullName   查询并列出文件名
Copy-Item -Destination f:\testOK -Force  复制之些文件到f:\testOK的目录
Move-Item -Destination f:\testOK -Force  移动之些文件到f:\testOK的目录
Remove-Item -Force   删除这些文件

也可以看看我这只问过的。
http://www.bathome.net/thread-58073-1-1.html

TOP

返回列表