Skip to content

Instantly share code, notes, and snippets.

@ethangardner
Created August 28, 2015 03:04
Show Gist options
  • Save ethangardner/22479f7e8d0c09284547 to your computer and use it in GitHub Desktop.
Save ethangardner/22479f7e8d0c09284547 to your computer and use it in GitHub Desktop.
Powershell script to bulk replace spaces with underscores in a directory of files
Dir | Rename-Item –NewName { $_.name –replace “ “,”_” }
@chitrakakkar
Copy link

How do you do that for a directory of folders?

@MCKPRO
Copy link

MCKPRO commented Jul 17, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment