Skip to content

Instantly share code, notes, and snippets.

@gjtorikian
Last active May 27, 2018 17:43
Embed
What would you like to do?
Geocities extraction script
require 'pty'
def run_cmd(cmd)
begin
PTY.spawn( cmd ) do |stdout, stdin, pid|
begin
# Do stuff with the output here. Just printing to show it works
stdout.each { |line| print line }
rescue Errno::EIO
puts "Errno:EIO error, but this probably just means " +
"that the process has finished giving output"
end
end
rescue PTY::ChildExited
puts "The child process exited!"
end
end
dirs = %w(UPPERCASE)
dirs.each do |dir|
Dir.chdir(dir) do
puts dir
Dir["*.7z.001"].sort.each do |file|
basename = File.basename(file, ".*" )[0..-4]
if File.exist?(basename)# || basename < "geocities-C-z.7z"
puts "Skipping #{basename}"
next
end
puts "Working on #{file} ..."
run_cmd("7za x #{file} > /dev/null")
run_cmd("tar -zxf #{basename}")
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment