Powershell getting full path information -
i have directory called videos. inside directory, bunch of sub directories of various cameras. have script check each of various cameras, , delete recordings older date.
i having bit of trouble getting full directory information cameras. using following it:
#get of paths each camera $paths = get-childitem -path "c:\videos\" | select-object fullname
and loop through each path in $paths , delete whatever need to:
foreach ($pa in $paths) { # delete files older $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 }
when run script, getting errors such as:
@{fullname=c:\videos\pc1-cam1} get-childitem : cannot find drive. drive name '@{fullname=c' not exist. @ 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
is there way strip @{fullname= off of path? think may issue is.