Skip to content

Instantly share code, notes, and snippets.

@mishin
Created June 2, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mishin/43f69757aea79f2e4d25 to your computer and use it in GitHub Desktop.
Save mishin/43f69757aea79f2e4d25 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use 5.010;
use Path::Iterator::Rule;
use File::Slurp;
die "Usage: $0 DIRs" if not @ARGV;
my $rule = Path::Iterator::Rule->new;
$rule->name("*.sql");
my $big_sql = $ARGV[0] . '/big.sql';
my $it = $rule->iter(@ARGV);
while (my $file = $it->()) {
say "$file was added to $big_sql";
write_file($big_sql, {append => 1}, read_file($file));
}
#thanks for Gabor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment