added '~' compatibility, -R recursion, and ls file compatibility