main command to run on a directory