如何从共享文件夹中查找包含'abc'作为文件名一部分的文件,然后将其删除? [英] How to find files containing 'abc' as part of filename from shared folder and then delete them ?
问题描述
我有共享文件夹\\Test \ PQR。它有很多文件。我想只删除那些包含'abc'作为文件名一部分的文件,这些文件应该超过4天。
如何使用powershell脚本完成此操作?
感谢您对此的任何帮助。
我的尝试:
Get-ChildItem -Path\\intranet.barcapint.com\dfs-emea \Group \ Ldn\Apps \CMCV \\\\\\\\\\\\\\\\\\\\\\\ - 递送| Where-Object {$ _.LastWriteTime -lt(Get-Date).AddDays(-4)} | ForEach-Object {$ _.FullName}> F:\\\ output_DTU.txt
我无法确定文件名是否包含'abc'。
I have shared folder "\\Test\PQR". It has many files. I want to delete only those files which contains 'abc' as part of the filename and those files should be older than 4 days.
How to accomplish this using powershell script ?
Appreciate any help on this.
What I have tried:
Get-ChildItem –Path "\\intranet.barcapint.com\dfs-emea\Group\Ldn\Apps\CMCV\EM\FTPProd\DTU" -Recurse | Where-Object {$_.LastWriteTime -lt (Get-Date).AddDays(-4)} | ForEach-Object { $_.FullName } > F:\output_DTU.txt
I am not getting how to identify whether file name contains 'abc'.
推荐答案
_.LastWriteTime -lt(Get-Date).AddDays(-4)} | ForEach-Object {
_.LastWriteTime -lt (Get-Date).AddDays(-4)} | ForEach-Object {
_。FullName}> F:\\\ output_DTU.txt
我无法确定文件名是否包含'abc'。
_.FullName } > F:\output_DTU.txt
I am not getting how to identify whether file name contains 'abc'.
你可以尝试
这篇关于如何从共享文件夹中查找包含'abc'作为文件名一部分的文件,然后将其删除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!