简体   繁体   English

PowerShell - 按修改日期删除特定文件夹中的文件

[英]PowerShell - Delete files by modified date in specific folders

Reading to the source is not working or i'm not even sure if everything is working.. need your help guys.阅读源代码不起作用,或者我什至不确定一切是否正常......需要你们的帮助。

Thanks!谢谢!

$Src = C:\Users\Asus\Documents\PowerShell\Folder.txt

Get-ChildItem –Path $Src -file -Recurse | Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-30))} | Remove-Item -Whatif

content on Folder.txt Folder.txt 上的内容

New Folder

New Folder(2)

Try using:尝试使用:

$Src = "C:\Users\Asus\Documents\PowerShell\Folder.txt"
Get-ChildItem –Path (Get-Content $Src) -file -Recurse

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM