Rewrite most file-retrieval functions

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>