Stefans Tools

Useful open source tools that make your life easier


tabspace is a small command line tool that converts tabs to spaces or spaces to tabs automatically in files. It also removes spaces at the end of lines.

It works with ANSI, UTF-8 and even UTF-16 (on Windows mostly referred to as Unicode) files alike.

The conversion is done so that the alignment always stays the same - the conversion does not simply replace the characters, but uses an algorithm to find out how the replacement has to be done.

The command line is:

tabspace [/path:"path\to\convert"] [/checkonly] [/usetabs]
         [/tabsize:4] [/leaveeol] [/ext:"extension;list"]
specifies the directory where all the files are to be converted, or a path to a single file to be converted
if specified, the files are not modified but only an info is shown
convert spaces to tabs instead of tabs to spaces
specifies the tab size, defaults to 4
if specified, whitespaces at the end of lines are not removed
a list of file extensions to scan, other extensions are ignored. Defaults to c;cc;cpp;cs;cxx;h;hpp;hxx
a list of patterns to include, separated by ;. If this is set, /ext must not be set!
For example c:\sub1\*.*;*\sub2\*.cpp.
a list of patterns to ignore, separated by ;.
For example c:\sub1\*.*;*\sub2\*.cpp.

You can download the tool from here. The source code is here.