---
title: "Improving the Dropbox sync #2"
slug: improving-the-dropbox-sync-2
section: tech
date: 2015-05-14T11:37:00.000Z
canonical: https://roland.leth.ro/blog/tech/improving-the-dropbox-sync-2
---

I remembered I have a Hazel [rule](/tech/blog/dropbox-sync-for-the-blog) that syncs the files automatically when a new file is added. So I realised I can improve the future posts even further: instead of excluding files, it's better to exclude posts, based on date:

```ruby
get '/' do
  [...]
  all_posts.reject! do |post|
    time_from_string(post[:datetime]) == nil || DateTime.now.to_time < time_from_string(post[:datetime])
  end
  [...]
end

get '/feed' do
  [...]
  posts.each do |post|
    next if time_from_string(post[:datetime]) == nil || DateTime.now.to_time < time_from_string(post[:datetime])
    [...]
    end
  [...]
end
```