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,
Answer
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).
No comments:
Post a Comment