Fastest way to search a directory for file names with specific charachters?

1

I have a directory which contains sub folders which contain files with very diverse names from many different users so they are not named very consistently. I am moving this directory to a sharepoint site which does not allow certain characters as file names because the way it was designed they are reserved characters.

Invalid chars: " # % & * : < > ? \ / { | } ~

Referenced from: http://www.thesug.org/mossasaurus/Wiki%20Pages/SharePoint%20Invalid%20Characters.aspx

As you can see there are many chars which I would have to look for, I could tear through the many folders and hundreads of files hunting for each invalid char by eye, but is there a faster way can I go about searching the master folder which contains sub folders as well as their contents for each or every one of these chars so that only the folders and files with the bad chars show up?

Thank you for your time,

John Dream

Posted 2013-01-09T18:15:51.330

Reputation: 437

Answers

2

This ought to do the trick for you:

dir *#* *%* *^&* *{* *}* *~*  /s /b > bad_file_names.txt

This should pick up the files with bad characters and dump them in a neat little text file list. I omitted the characters that should already be invalid on Windows (I assume you're running Windows what with the SharePoint server).

Tanner Faulkner

Posted 2013-01-09T18:15:51.330

Reputation: 11 948

1

Try something like Agent Ransack or WinGrep to search for the Regular Expression pattern:

["#%&*:<>?\/{|}~]

snowdude

Posted 2013-01-09T18:15:51.330

Reputation: 2 560