5

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
Stephan Kristyn
  • 15,015
  • 14
  • 88
  • 147

1 Answers1

5

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
SlashmanX
  • 2,489
  • 18
  • 16