Is there a built-in function to copy a directory and recursively copy all the files (and other directories) in Dart?
No, not to my knowledge there isn't. But Dart supports basic reading and writing of files from directories, so it stands to reason that this could be solved programmatically.
Check out this gist I found of a tool that would accomplish this process.
Basically, you would search the directory for files you wanted to copy and perform the copy operation:
newFile.writeAsBytesSync(element.readAsBytesSync());
to all file paths, new Path(element.path);
, in the new Directory(newLocation);
.
Edit:
But this is super inefficient, because the whole files has to be read in by the system and wrote back out to a file. You could just use a shell process spawned by Dart to take care of the process for you:
Process.run("cmd", ["/c", "copy", ...])