Fix filter bug

S3 prefixes were not being taken into account when determining the root
directory.

Fixes https://github.com/aws/aws-cli/issues/794

cc @jamesls @danielgtaylor