copyFolder function
Implementation
void copyFolder(String path, String pastePath){
Directory(path).listSync().forEach((element) {
if (element is File){
File file = File('$pastePath\\${element.path.split("\\").last}');
file.createSync();
file.writeAsBytesSync(element.readAsBytesSync());
} else if (element is Directory){
Directory dir = Directory('$pastePath\\${element.path.split("\\").last}');
dir.createSync();
copyFolder(element.path, dir.path);
}
});
}