Created
October 24, 2009 06:45
-
-
Save robc/217400 to your computer and use it in GitHub Desktop.
Simple Ruby script to unzip all files in the current working directory
This file contains hidden or 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 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very useful, thanks
I think there is a missing 'then'
But great to not need an unzipping gem