Maybe like this?
```ruby
folders.sort_by { |_, opts| opts[:hostpath] }.each do |_, opts|
```