sync: fixed directory creation in 'sync'

- Added a call to 'stat_local' for directories, so directories
  actually get created correctly now
- Removed directory creation in 'main' now that the one in 'sync' works
- File and directory creation are now both in sync
- Added tons more debugging output