Updated API versions and added permissions.
Added directory discovery and file moving.