我有一个powershell脚本,可以将文件从一个文件夹复制到另一个文件夹。
$files = Get-ChildItem "\\source" -filter "1*.835" | select Name,CreationTime
foreach ($f in $files){
if (-Not (Test-Path -Path "G:\destination\$($f.name)") -and -Not (Test-Path -Path 
"G:\destination\$($f.name)") -and $f.CreationTime -ge  "4/24/2019"){
Copy-Item -Path "\\source\$($f.Name)" -Destination 'G:\835'
}}
$filenames = New-Object 'System.Collections.Generic.List[String]'
$files = Get-ChildItem "G:\835" -Filter '*.835' | select Name我需要改变:
$files = Get-ChildItem "\\source" -filter "1*.835" | select Name,CreationTime类似这样的东西:
 $files = Get-ChildItem "\\source\*.835" | ? { $_.Name -match "[0- 9]*.835" } | Where-Object {$_.CreationTime -gt "12/21/2019" -and $_.CreationTime -lt "01/02/2020"} | select Name,CreationTime发布于 2020-01-03 02:12:36
我把它改成了:
    $files = Get-ChildItem "\\source\[0-9]*.835" | select Name,CreationTimehttps://stackoverflow.com/questions/59567683
复制相似问题