PoshCode Archive  Artifact Content

Artifact 703bff03b6242905b1f2b55cf54f66b24b294c2d1f0782f0dfb05d28a8f50b36:

  • File Remove-Special-Char.ps1 — part of check-in [1368613a2d] at 2018-06-10 14:07:32 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: 6075
# x-archived: 2016-05-17T08:42:54
# x-published: 2016-10-30T09:32: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\.]','') }