Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

space --> underscore

$
0
0

Hi

Where this error?. I want to rename files and folders that have a space with underscore, but only makes me the files.

Get-ChildItem $path -Recurse |`
    Where-Object {$_.Name -match ' '} |
    Where-Object {$_.Attributes -notmatch 'Directory'} |`
    Rename-Item -NewName { $_.Name -replace ' ', '_' } -WhatIf 


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>