Hej man, why are you using this ?
dir /s/b/o:gn > f.txt (wrong one)
Don't you know what is that 'g' in '/o' ??
Check this out: http://www.computerhope.com/dirhlp.htm or dir /? for dir help
You should be using this instead:
dir /s/b/o:n > f.txt (right one)