extra c: added to destination path on windows ((Error code: ENOENT))

43 Views Asked by At

Using latest version of grunt if we try to work like copying

copy: {

main: {

    files: [
        {   expand: true 
            src: ['/dev/war archive/latestfile/**/*.txt'], 
            dest: '/fernando/backups/pbuse/war',
            filter :'isFile' 
        }
    ]

}   

}
This will result in Error: Unable to create directory "C:\harikishore\backups\war\C:" (Error code: ENOENT)

1

There are 1 best solutions below

0
HariKishore K On

In latest version of grunt we need to add the cwd(currentworkingdirectory) where the provided src is located for the action otherwise grunt-action will consider the actual system path included with src,so while creating destination will try to create the systempath which will result in the above error so it will work if change the code as below:

copy: {

main: {

    files: [
        {   expand: true, 
            cwd : '/dev/war archive/latestfile/'
            src: ['**/*.txt'], 
            dest: '/fernando/backups/pbuse/war',
            filter :'isFile' 
        }
    ]

}   

}

So,now it will start the dest folder creation from src instead of system path included

Alternative: adding flaten:true property This will allow us to pass the action since we are not creating the inner folder structure of src in dest just copying all the files and dumping in single outer folder.

If we need inner folder structure of src in dest also then we must need cwd