S3 Repository: Fix creating directory for the target

Fix a few bugs:
Make sure that there is a terget directory for the downloaded file
Do not expect an empty directory in the bucket

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>