convert option parsing to argparse
This replaces deprecated optparse with argparse.
It also changes the syntax of how to specify the directory. Instead of passing -d, the directory must now be passed as the final positional argument to the script. This makes sense, because it is mandatory, and using options for mandatory things is confusing.
CC @akitouni