The problems of Sharepoint not accepting all chars in filenames (&{} etc..) sometimes brings problems when you need to migrate a large number of files from filesystem. I have not yet found any program which can be batched to make this work easy. I have found SharePrep (http://www.purgeie.com/shareprep/) but I see two problems with this software: 1) it’s not freeware, 2) its not batchable (command-line). This is why I started to make ShareCheck.
The ShareCheck will traverse a directory structure and rename files which have chars not allowed by sharepoint. The program have a built-in conversion table, but you are also able to specify a external XML-file for denfinition of the conversion rules, which in turn mean that this app can be for other purposes as well. When executed the program will output a XML output which could be piped or redirected to se the results (human readable output is also availiable).
Usage of ShareCheck.exe, commandline arguments:
-path=”g:\pathtomigrate”: Specifies the path to files to process, if ommited current directory will be used.
-config=”c:\config.xml”: Specified the alternative config (se example-config.xml for defaults used when nothing specified)
-norecurse: Do not recurse subdirectories, only process the starting directory
-legacyoutput: Do not output XML, but rather a HR-text (Human Readable Text)
-whatif: Do not actualy rename the files, but just simulate what would be done
Default configuration XML (built-in and used if none is specified):
<sharecheck> (root element)
<filechecks> (all file checks collected here)
<startwith match=”.” replace=”” /> (startwith is to check if a specific file starts with something and replace it)
<startwith match=” ” replace=”” />
<filename match=”#” replace=”_” /> (filename checks the filename for the occurance anywhere and replaces)
<filename match=”&” replace=”_” />
<filename match=”"” replace=”_” />
<filename match=”%” replace=”_” />
<filename match=”:” replace=”_” />
<filename match=”*” replace=”_” />
<filename match=”<” replace=”_” />
<filename match=”>” replace=”_” />
<filename match=”?” replace=”_” />
<filename match=”\” replace=”_” />
<filename match=”{” replace=”_” />
<filename match=”}” replace=”_” />
<filename match=”~” replace=”_” />
<filename match=”|” replace=”_” />
<filename match=”/” replace=”_” />
</filechecks>
</sharecheck>
Still to-do:
* Check for long directory names as well
* Actualy implement -norecursion (it’s currently broken)
Thinking of…
* Replace -whatif with -commit to always run in testmode unless specified??
* Other suggestions??
The executable are compilled for x32 and x64, its built in C# and uses .NET 3.5. The software is somewhat beta which means that you should test it before you use it in a real enviroment. No warranties, expressed or otherwise, at all – use on your own risk! The software is free, you may distribute it as you wish but please keep my info in it. Download it here.