Skip to content

Instantly share code, notes, and snippets.

@noah
Created August 25, 2012 04:34
Show Gist options
  • Save noah/3460793 to your computer and use it in GitHub Desktop.
Save noah/3460793 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# encoding: utf-8
#
require 'bencode'
# print the list of files which are in a given directory, but not currently seeding in rtorrent
#
# This script answers the question / problem:
# "I have a ton of stuff downloading in rtorrent, and it's all going
# into one directory. What stuff from that directory can be safely
# moved (is no longer tied to rtorrent)?"
#
# Usage: $0 </path/to/rtorrent/.sessions/*.rtorrent> </path/to/directory_of_files>
#
seeding = ARGF.collect do |str|
BEncode.load(str.encode! "UTF-8", "UTF-8", :invalid => :replace)['directory']
end.sort
dir_contents = Dir["/drum/bt/*/*"]
puts (dir_contents - seeding).sort
#puts dir_contents-seeding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment