#line 68 "/home/travis/build/felix-lang/felix/src/packages/filetools.fdoc"
  include "std/felix/flx_cp";
  
  fun dbg(s:string):string={ println s; return s; }
  //println$ System::args ();
  //println$ "argc=" + str System::argc;
  
  var dir = "";
  var regex = "";
  var target = "";
  var live = true;
  var verbose = false;
  
  for var i in 1 upto System::argc do
    var arg = System::argv i;
    if arg == "--test" do live = false;
    elif arg == "-v" or arg == "--verbose" do verbose = true;
    elif arg.[0] == char "-" do
      println$ "Unknown option '" + arg+"'";
      System::exit(1);
    elif dir == "" do dir = arg;
    elif regex == "" do regex = arg;
    elif target == "" do target = arg;
    done
  done
  
  if dir == "" do println$ "Missing directory name (arg1)"; System::exit(1);
  elif regex == "" do println$ "Missing regex (arg2)"; System::exit(1);
  elif target == "" do println$ "Missing target (arg3)"; System::exit(1);
  done
  
  if verbose do println$ "#Dir='" + dir + "', pattern='"+regex+"', dst='"+target+"'"; done
  
  var re = Re2::RE2 regex;
  CopyFiles::copyfiles (dir, re, target, live, verbose);
  System::exit(0);