Removing File Extensions (Unsafe)

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell

Some users use Trim() to remove file extensions like this:


This seems to work great, but in reality, Trim() removes all the characters you submitted from the beginning and end of the text. Check this out:


The file name is missing the last "t" because "t" is part of the characters Trim() removes.


Twitter This Tip! ReTweet this Tip!

Posted Jul 14 2011, 06:00 AM by ps1
Copyright 2012 All rights reserved.