J. Chase J. Chase - 1 year ago 241
Javascript Question

Clear HTML5 Filesystem API

How does one completely empty (or delete all files in) a filesystem?

Is there no 1 line solution like localStorage (

)? Or am I missing something really, really obvious?

Apparently, I wasn't very clear. I'm referring to the HTML5 Filesystem API. http://www.html5rocks.com/en/tutorials/file/filesystem/

Answer Source

2016 Update: The File API "Directories and System" effort has been abandoned and what little support had made it into browsers is being dropped. The original File API is still valid, but the stuff providing an entire file area on the user's system has been abandoned.

It looks like DirectoryEntry#removeRecursively does that. It says you can't remove the root of a file system, but you can loop through the entries in the root and remove them recursively (or just always work with a subdirectory of the root, thereby letting you remove that with a one-liner).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download