Skip to content

Instantly share code, notes, and snippets.

@jwarwick-bry
Created August 13, 2025 21:24
Show Gist options
  • Select an option

  • Save jwarwick-bry/cd486b3867d4a43c4d77189c34018be1 to your computer and use it in GitHub Desktop.

Select an option

Save jwarwick-bry/cd486b3867d4a43c4d77189c34018be1 to your computer and use it in GitHub Desktop.
Fix accidentally repeated filename extensions in Windows. For instance, if your Windows Explorer had the hide filename extensions option turned on, so you added filename extensions which then were actually extraneous.
get-ChildItem -recurse |?{ $_.name -match "(\.[A-Z]{1,5}){2,}" } |%{ $FIXED = $_ -replace "(\.[A-Z]{1,5}){2,}",'$1' ; move-Item -verbose "$_" "${FIXED}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment