You don't need to resolve here, just get the dirname portion. Also, you're missing a `var`, and leaking a global:
```javascript
var destdir = Path.dirname(destpath);
```