Is it possible to delete "C:" using Directory.Delete?

3

Using Directory.Delete("C:", true) deletes the partition? Or is it just blocked and does not execute?

    
asked by anonymous 20.09.2016 / 16:05

1 answer

4

Directory.Delete() is done to delete files and folders . It can not delete a partition that is on a lower layer than it is using.

It will attempt to delete all folders on this partition. But it will depend on permissions. If you are running the application with administrator privilege it will cause a pretty mess. Even so, it will not erase everything. Other issues may prevent deletion, as documented in the documentation.

Any attempt will depend on permission.

There is no special treatment for any situation.

If you want to understand the details, you can track your source code . At some point it delegates to the operating system.

    
20.09.2016 / 16:38