Created
December 29, 2011 19:18
-
-
Save taicki/1535733 to your computer and use it in GitHub Desktop.
Move files to trash in Terminal
This file contains 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 macruby | |
framework 'Cocoa' | |
urls = ARGV.map {|a| NSURL.fileURLWithPath(a) } | |
run = true | |
complete = lambda {|n, e| run = false } | |
NSWorkspace.sharedWorkspace.recycleURLs(urls, completionHandler: complete) | |
rl = NSRunLoop.currentRunLoop | |
future = NSDate.distantFuture | |
while (run && rl.runMode(NSDefaultRunLoopMode, :beforeDate => future)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment