Skip to content

Instantly share code, notes, and snippets.

@robc
Created October 24, 2009 06:45
Show Gist options
  • Save robc/217400 to your computer and use it in GitHub Desktop.
Save robc/217400 to your computer and use it in GitHub Desktop.
Simple Ruby script to unzip all files in the current working directory
#!/usr/bin/env ruby
# Invokes unzip for each file in a given directory
completed_files = Array.new
current_directory = Dir.getwd
Dir.foreach(current_directory) do |file_name|
if (file_name.include?(".zip") && !completed_files.include?(file_name))
system("unzip", file_name)
completed_files << file_name
end
end
@SarahTaylorProject
Copy link

very useful, thanks
I think there is a missing 'then'
But great to not need an unzipping gem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment