Can I do delete all files in apples directory without deleting the directory itself? fs-extra API does not describe if it is possible.
fsExtra.remove 'apples/*', ->
if !err
# Do stuff
fs-extra adds file system methods that aren't included in the native fs module and adds promise support to the fs methods. It also uses graceful-fs to prevent EMFILE errors. It should be a drop in replacement for fs .
You can use the FileUtils. cleanDirectory() method to recursively delete all files and subdirectories within a directory, without deleting the directory itself. To delete a directory recursively and everything in it, you can use the FileUtils.
In Node. js, you can use the fs. unlink() method provided by the built-in fs module to delete a file from the local file system.
You can delete multiple files or folders by holding down the Ctrl key and clicking each file or folder before pressing Delete . You can hold down the Shift key while pressing the Delete key to prevent files from going to the Recycle Bin when deleted.
You can use emptyDir
Ensures that a directory is empty. If the directory does not exist, it is created. The directory itself is not deleted.
fsExtra.emptyDir 'apples/', ->
if !err
# Do stuff
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With