Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recursively remove entire directory with files in Dart?

Tags:

dart

How do you recursively remove an entire directory in Dart along with all the files?

For example:

/path/to/project/foo.dart
/path/to/project/remove/all/of/these
like image 899
Ahmed Avatar asked Dec 29 '12 14:12

Ahmed


1 Answers

It's easier than it sounds.

If I understood you right, it would go like this:

import 'dart:io';

main() {
  // Deletes the directory "remove" with all folders and files under it.
  new Directory('remove').delete(recursive: true);
}
like image 165
Kai Sellgren Avatar answered Nov 15 '22 10:11

Kai Sellgren