Page 1 of 1

Removing . from beginning of files

PostPosted: Tue Jul 02, 2019 5:54 pm
by simong84
Hi All

I have a folder full of sub folders and within those, some files that have . at the beginning.

Would someone please tell me the best way to run through all sub folders and remove any leading . or replace them with _ ?

Thanks

Simon

Re: Removing . from beginning of files

PostPosted: Tue Jul 02, 2019 7:59 pm
by therube
Select your parent folder.

12:Filters -> Subfolders (if need, seems you do)

3:Replace
.
with
<leave blank>

Looks like it should work:

._namespace.js ---> _namespace.js

Re: Removing . from beginning of files

PostPosted: Tue Jul 02, 2019 9:49 pm
by simong84
Thanks for the reply.

The problem is, we don't want to replace all dots - only any that are the first character on the file path.

We are uploading onto SharePoint and it doesn't like it if a . is the first character but they can exist elsewhere in the file name.

Re: Removing . from beginning of files

PostPosted: Wed Jul 03, 2019 1:39 am
by therube
Heh, oh.

And when I searched on my end for files that started with ., my search was (in Everything) regex:^\.

So... in BRU try this instead of 3:Replace:

1:RegEx
Code: Select all
Match:  (^\.)(.*)
Replace:  \2

Re: Removing . from beginning of files

PostPosted: Wed Jul 03, 2019 1:50 am
by Admin
With Javascript Renaming in Bulk Rename Utility:

Code: Select all
if (name.charAt(0) == ".") newName = name.substring(1);


the above script removes the . in the first position.

Or to replace with _ :

Code: Select all
if (name.charAt(0) == ".") newName = "_" + name.substring(1);