I've had reasonable success by doing it electrolytically.
I used dilute sulphuric acid from my local battery supplier as the electrolyte, from memory let down about 1:3, and a 1 v car battery charger as the power source, but just make sure you connect everything electrically before powering up as sparks and hydrogen are not ideal bedfellows in one's workshop. This is even more important when powering down.
The file needs to be the anode, and the cathode should face all sides of the file to be sharpened.
For the tank, I used a plastic measuring cylinder as it is tall and thin, thus minimising the amount of acid needed.
The cathode was made from a spiral of cunifer brake pipe as I had it lying around at the time.
For obvious reasons, goggles, gloves, old apron etc are to be advised, as it doing the job outside the workshop to save corroding anything.
Clean the file in caustic soda to degrease before you start, and rinse in a bucket of water following sharpening.
An immediate application of your favourite aerosol water displacer should follow as it will corrode frighteningly quickly. I used WD40.
Good luck and take care.