Skip to content

Instantly share code, notes, and snippets.

@taicki
Created December 29, 2011 19:18
Show Gist options
  • Save taicki/1535733 to your computer and use it in GitHub Desktop.
Save taicki/1535733 to your computer and use it in GitHub Desktop.
Move files to trash in Terminal
#!/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