Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Rename files removing everything after spaces- Help Please

$
0
0

I have tens of thousands of files with duplicated names separated by a space such as:

filename1 filename1.pdf

I need to get this to read

filename1.pdf

I have found this:

Dir | Rename-Item –NewName { $_.name –replace “ “,”_” }

There are many differences among these file name compositions (letters, numbers, characters, no spaces though, etc.)

I have not been able to find anything that uses wildcard to properly solve this.

Any help is greatly appriceated. I am really new to powershell and coding in general FYI.

Thank you!!


Viewing all articles
Browse latest Browse all 6937

Trending Articles