# copyVhd method

Future<String> copyVhd(

1. String name,
2. String newName

)

Copy a WSL distro by name and vhd

## Implementation

    Future<String> copyVhd(String name, String newName) async {
      String vhdPath = getInstancePath(name).file('ext4.vhdx');
      String copyPath = getInstancePath(name).file('ext4.copy.vhdx');
      // Copy path to new location so instance doesn't have to be stopped
      File file = File(vhdPath);
      if (file.existsSync()) {
        file.copySync(copyPath);
      } else {
        return 'File not found';
      }

      String importRes = await import(
          newName, getInstancePath(newName).path, copyPath,
          isVhd: true);

      // Cleanup, delete file
      File file2 = File(copyPath);
      if (file2.existsSync()) {
        file2.deleteSync();
      }
      return importRes;
    }