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.
by ChrisL at 2012-10-17 11:53:32
That fixed it; thank you so much!!
The topic ‘Get-ChildItem and subfolder pathing’ is closed to new replies.