Grunt-contrib-clean task does not delete files using src network path

I had a problem trying to clear the distribution directory on a remote file server. I have a folder and access it through a double slash, for example

//foldername/projectname/subfolder/

I configured my Gruntfile.js for the grunt-contrib-clean task as follows:

clean: {
    files: [
        {
            src: ['//foldername/projectname/subfolder/']
        }
    ]
}

In my task list, I also have a task for copying grunt-contrib-copy, which starts after grunt-contrib-clean to load the distribution, and this task uses the same src path to a folder on the network .

So, when I run grunt, the “clean” task does not actually clear the subfolder, but the “copy” successfully copies the files. When I try to run grunt with the --verbose command, I have the following log:

Running "clean" (clean) task
Verifying property clean exists in config...OK
Files: [no src]
Options: force=false, no-write=false
Options: force=false, no-write=false

, , , - undefined. , Windows. / .

- , . !

+4
2

. :

dev: {
          options: {
            'force': true
          },
          expand: true,
          cwd: '//someserver/someshare/somepath',
          src: '{,*/}*'
        },
0

force = true, :

force

Type: Boolean
Default: false

This overrides this task from blocking deletion of folders outside current working dir (CWD). Use with caution.

no-write = true, .

, , ​​ Windows:

2013-07-15   v0.5.0   Use rimraf directly, version 2.2.1 to fix issue on Windows. Add no-write option to mimic grunt.file.delete behavior.

-1

Source: https://habr.com/ru/post/1532146/


All Articles