Future<Directory> rename(String newPath)

Renames this directory. Returns a Future<Directory> that completes with a Directory instance for the renamed directory.

If newPath identifies an existing directory, that directory is replaced. If newPath identifies an existing file, the operation fails and the future completes with an exception.

Source

Future<Directory> rename(String newPath);