更新时间:2023-12-04 20:40:22
检查这个:
脚本获取超过指定时间的文件期限PowerShell [ ^ ]
删除早于x天的文件 - 清理脚本 [ ^ ]
使用PowerShell删除超过15天的文件 - Stack Overflow [ ^ ]
并根据您的需要进行更改;)
#获取中的文件列表原始文件夹
rootFolder = C:\ MyFiles \ Output 跨度>
Hi, I am new to powershell scripting. I found this[^] article on creating a zip folder but I don't know how to specifically find files older than 1 week.
What I have tried:
I have tried using a foreach loop and copying the files into a temp directory and then using the link I found earlier but Powershell syntax is not working properly.
Check this:
Script Get files older than a specified time period PowerShell[^]
Delete files older than x-days - Cleanup Script[^]
Delete files older than 15 days using PowerShell - Stack Overflow[^]
And change to your needs ;)
#get the list of files in the original folder
rootFolder = "C:\MyFiles\Output"