I need to copy some files to the same place another file exists on remote machines. So far I’ve been able to find the file and return the path with the script below but the path is an object not a string and contains property information I don’t need.
$Path = Get-ChildItem -Path C: -Filter “File.txt” -Recurse -ErrorAction SilentlyContinue -Force | Select-Object -Property FullName write-host $PathString
I need to return the path as a string for use to copy other files to the directory.
submitted by /u/lesserlumpkin
[link] [comments]
The post How do I search for a file and return the directory path the file is in. appeared first on How to Code .NET.