Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

updateAndDelete does update, but not delete when destination is UNC path #18

Open
chrischain opened this issue Oct 3, 2014 · 12 comments

Comments

@chrischain
Copy link

Hello, just updated to v0.2.0 because I'm really looking forward to the destination file deletion, but so far it is not working for me. I'm wondering if it has something to do with the fact that my destination is a UNC path...

Here are the relevant parts of my gruntfile.js:

//this variable holds the target UNC path for file transfers
var devPath = '//abcdefg01/Webdev/Unit/ump.dev.company.com/ease/schedules/';

module.exports = function(grunt) {
    var rev = 1744;

    //project configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        sync: {
            main: {
                files: [{
                    cwd: './',
                    src: ['**/*.cfc', '**/*.cfm', '**/*.css', '**/*.gif', '**/*.js', '**/*.png', //includes
                    '!**/gruntfile.js', '!**/DO_NOT_UPLOAD/**', '!**/node_modules/**', '!**/out/**' //excludes
                    ],
                    dest: devPath
                }],
                pretend: true,
                updateAndDelete: true,
                verbose: true
            }
        }
    });

    //load plug-ins
    grunt.loadNpmTasks('grunt-sync');

I've tried with pretend true || false, nothing seems to change.

Any help/guidance is appreciated.

@tomusdrw
Copy link
Owner

tomusdrw commented Oct 3, 2014

Do you get any verbose output when running the task?
Could you try to remove trailing / in dest path?
I suspect that you are running Windows. Could you try to use \ instead of / in dest path?

@chrischain
Copy link
Author

You are correct about Windows.

I do get verbose output, and updates seem to be functioning normally, however I have yet to see it delete anything.

If I remove the trailing slash, it seems to perform the same as if I did not. It still does not remove files, only performs updates.

Regarding the last suggestion, I can't use backslashes because the JS parser chokes:

var devPath = '\\abcdefg01\Webdev\Unit\ump.dev.company.com\ease\schedules\
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Loading "gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected token ILLEGAL
Warning: Task "sync" not found. Use --force to continue.

Aborted due to warnings.

Thanks for looking into this!

@tomusdrw
Copy link
Owner

tomusdrw commented Oct 5, 2014

Hi!
You have to escape all \ characters. Try using shorter form:

var devPath = ['', '', 'abcdefg01', 'Webdev', 'Unit', 'ump.dev.company.com', 'ease', 'schedules'].join("\\");

If in verbose output you get messages that something will be deleted then changing pretend to false should actually delete the file.

If not I will look close to your configuration and see if I've missed some case in code.

@chrischain
Copy link
Author

After changing the devPath to match your suggestion, it still does not indicate any delete operations will be performed, just updates.

There are at least 6 items in subfolders and one item in the root path that should be deleted.

@chrischain
Copy link
Author

I did some cursory troubleshooting, and I see that the paths variable and the result array in your second pass is coming up empty.

I also see that the destPaths variable returns the promise object, but doesn't seem to contain any usable data (at least when I attempted to enumerate it).

I hope this helps.

@shiraze
Copy link

shiraze commented Oct 15, 2014

I also see a similar problem. I'm also on Windows and I've tried the suggested fixes without any success. Are there any items worth logging that would help determine why the delete of a file is not happening.

@tomusdrw
Copy link
Owner

I'm terribly sorry guys, but didn't have time yet to look at your issue. I promise to look at this in a few days.

@vizo
Copy link

vizo commented Oct 28, 2014

I am running it on linux ... and it doesn't want to copy ... logs out that it's copying but it's not ... just if i put on updateAndDelete: false then it copy ....

@tomusdrw
Copy link
Owner

I was looking into your issues and I couldn't find anything that could help. Could you prepare minimal Gruntfile & demo to reproduce your issue?

@chrischain
Copy link
Author

Any updates on this issue? Tomasz, do you need any additional information from me? I'm happy to help where I can...

@tomusdrw
Copy link
Owner

tomusdrw commented Nov 8, 2014

@chrischain I dug into your issue and it seems that it won't be working with UNC paths until it will be supported in glob (see isaacs/node-glob#74)

Let's wait until this is fixed in glob. I'll update library and we can see if it works.

@vizo @shiraze Since this thread is related to UNC path, please open new issue if you experience different problems.

@tomusdrw tomusdrw changed the title updateAndDelete does update, but not delete updateAndDelete does update, but not delete when destination is UNC path Nov 8, 2014
@shiraze
Copy link

shiraze commented Nov 8, 2014

Thanks! Much appreciated

In fact, after further thought, we would rather not yet have the ability to
delete files from the target location. It's a good feature for grunt-sync
but not one we need.

Keep up the good work
On 8 Nov 2014 12:30, "Tomasz Drwięga" notifications@github.com wrote:

@chrischain https://github.com/chrischain I dug into your issue and it
seems that it won't be working with UNC paths until it will be supported in
glob (see isaacs/node-glob#74
isaacs/node-glob#74)

Let's wait until this is fixed in glob. I'll update library and we can see
if it works.

@vizo https://github.com/vizo @shiraze https://github.com/shiraze
Since this thread is related to UNC path, please open new issue if you
experience different problems.


Reply to this email directly or view it on GitHub
#18 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants