Recursively Rename Files to Their Directory Name and Keep Their Extension in Windows Power Shell Jul 21st, 2011 9:30 am Just a quick one: foreach($i in dir -Recurse -Include *.xml) {$parent = $i | Split-Path -Parent | Split-Path -leaf; $i | rename-item -newname {$parent + '.xml'}} That's it.