나는 Videos라는 디렉터리가 있습니다. 이 디렉토리 안에는 다양한 카메라의 하위 디렉토리가 있습니다. 다양한 카메라를 확인하고 특정 날짜보다 오래된 기록을 삭제하는 스크립트가 있습니다.Powershell의 전체 경로 정보 얻기
카메라의 전체 디렉토리 정보를 가져 오는 데 문제가 있습니다.
#Get all of the paths for each camera
$paths = Get-ChildItem -Path "C:\Videos\" | Select-Object FullName
을 그리고 $ 경로의 각 경로를 통해 나는 루프 내가해야 할 어떤 삭제 : I 스크립트를 실행하면
foreach ($pa in $paths) {
# Delete files older than the $limit.
$file = Get-ChildItem -Path $pa -Recurse -Force | Where-Object { $_.PSIsContainer -and $_.CreationTime -lt $limit }
$file | Remove-Item -Recurse -Force
$file | Select -Expand FullName | Out-File $logFile -append
}
, 나는 점점 오류가 나는 나는 그것을 얻기 위해 다음과 같은 사용하고 예 :
@{FullName=C:\Videos\PC1-CAM1}
Get-ChildItem : Cannot find drive. A drive with the name '@{FullName=C' does not exist.
At C:\scripts\BodyCamDelete.ps1:34 char:13
+ $file = Get-ChildItem -Path $pa -Recurse -Force | Where-Object { $_.PSIsCont ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (@{FullName=C:String) [Get-ChildItem], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
@ {FullName = 경로에서 제외 하시겠습니까? 그게 문제가 될 수 있다고 생각합니다.