PoshCode Archive  Artifact Content

Artifact 991c9ffe32dfb1605ef297542659924934fc52ec057ccc323106d8452b2def2d:

  • File Remove-Special-Char.ps1 — part of check-in [aa6676738c] at 2018-06-10 13:22:19 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: 3216
# x-archived: 2017-05-22T05:29:21
# x-published: 2012-02-09T14:27: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\.]','') }