Skip to content

Instantly share code, notes, and snippets.

@jrpz
Created March 18, 2011 19:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrpz/876704 to your computer and use it in GitHub Desktop.
Save jrpz/876704 to your computer and use it in GitHub Desktop.
Combine text based files within a directory into a single file. Requires 'directory' and 'file' parameters.
dir = Dir.new(ARGV[0])
file = File.open(ARGV[1], 'w')
dir.each{|d|
if (d[0] != '.')
f = File.open(ARGV[0] + d)
file.write(f.read)
f.close
end
}
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment