Subject: Re: [Name Mangler Talk] removing underscore at beginning of filename

From: Rob Griffiths <[email-masked]>
Date: Fri, 8 May 2015 19:05:00 -0700

On May 8, 2015, at 10:28 AM, Von <[email-masked]> wrote:

> when removing illegal characters from file names we decided to replace with an underscore, problem is some of file names begin with illegal characters.
> is it possible to remove the illegal characters and replace with an underscore, yet at the same time  not have a file name begin with an underscore ?

It's not possible in one step, but you could add a second step that checks for any names that begin with an underscore and remove them. So step one (or however many it takes) gets rid of the illegal characters, and then the last step checks and fixes any names that start with underscores.

To do that, use this very simple regular expression:

The carat means "from the beginning," and then we just find the underscore character. Any filenames that don't start with underscores will be left alone; those that have them will lose them.

Please test on a copy or subset of your files, of course!

-rob.

---

From: Von <[email-masked]>
Date: Fri, 8 May 2015 10:28:12 -0700 (PDT)

hi all,
when removing illegal characters from file names we decided to replace with 
an underscore, problem is some of file names begin with illegal characters.
is it possible to remove the illegal characters and replace with an 
underscore, yet at the same time  not have a file name begin with an 
underscore ?
thanks,
von