Skip to content

Instantly share code, notes, and snippets.

@bsutton
Created February 29, 2020 12:17
Show Gist options
  • Save bsutton/e73972c5530b8485b974ee8334d2297e to your computer and use it in GitHub Desktop.
Save bsutton/e73972c5530b8485b974ee8334d2297e to your computer and use it in GitHub Desktop.
Copy directory tree
void copyTree(String fromPath, String toPath) {
var list = find(
'*',
root: from,
recursive: true,
).toList();
for (var file in list) {
var target = join(toPath, relative(file, from: fromPath));
if (!exists(dirname(target))) createDir(dirname(target), recursive: true);
copy(file, target);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment