PoshCode Archive  Artifact [9f20540828]

Artifact 9f20540828fe53457f170f6ba41e9d34c71ac8b3711871fc9142d6335347c6f6:

  • File Remove-Special-Char.ps1 — part of check-in [071bbd6f32] at 2018-06-10 14:16:54 on branch trunk — This will recursively remove non-alphanumeric\decimal (via regex) characters from all folder and filenames. The decimals are left in tact for file extensions. (user: mjohnson size: 629)

# encoding: ascii
# api: powershell
# title: Remove Special Char
# description: This will recursively remove non-alphanumeric\decimal (via regex) characters from all folder and filenames. The decimals are left in tact for file extensions.
# version: 0.1
# author: mjohnson
# license: CC0
# x-poshcode-id: 6493
# x-archived: 2016-11-05T09:25:42
# x-published: 2016-08-29T09:29:00
#
# To replace the characters with another, modify the empty ‘ ‘) } section with your wanted word/char.
# Please use -whatif for testing.
#
gci 'c:\test\' -Recurse | % { Rename-Item $_.FullName $($_.Name -replace
	'[^\w\.]','') }