Last active
October 11, 2015 05:17
-
-
Save natan/3808307 to your computer and use it in GitHub Desktop.
Move everything on your desktop into ~/Dropbox/Documents/Desktops/<yyyy-mm-dd>/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'FileUtils' | |
require 'date' | |
def create_dir_if_necessary(path) | |
Dir.mkdir(path) unless File.directory?(path) | |
end | |
desktops_path = File.expand_path("~/Dropbox/Documents/Desktops") | |
create_dir_if_necessary(desktops_path) | |
today = Date.today.strftime('%Y-%m-%d') | |
today_path = File.expand_path("#{desktops_path}/#{today}") | |
create_dir_if_necessary(today_path) | |
FileUtils.mv(Dir.glob(File.expand_path("~/Desktop/*")), today_path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment