We use an atomic force microscope (AFM) to pattern metal surfaces in the nanometer range. Our technique is based on an electrochemical process called anodic oxidation. By applying a voltage between the AFM-tip and the sample substrate an electrochemical reaction is induced. With this technique several metals and semiconductors can be oxidized locally, i.e. in close vicinity of the tip scanning over the surface. We show how the formation of these oxide structures depends on key parameters, such as humidity and writing speed. Instead of a voltage source, we are using a constant current source to drive the oxidation. By means of this method, deficiencies related to the voltage source technique can be avoided. As a result, we are able to write structures on thin titanium films with excellent electronic properties. We focus on the patterning of titanium, since titanium is suited as a gate material on Ga[Al]As-heterostructures.