This seems like such a simple issue but I haven't been able to find anything on it. I'm using Get-ChildItem to recursively search through folder sets for particular text files, modify them, and then save the file. The problem I've been running into is that for files that are located in subfolders, instead of overwriting them, it saves them in the root folder instead. Is there a way to retreive the full path using GCI or is there a better way to do this?
The File object does contain the full path. The problem is that you're using $_, which is the whole file object, so it's defaulting to the Name property. You probably want to use something like $_.FullName instead.