scp error while attempting to copy files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite
1












I use scp to transfer files from my android to my MacBook which works like a charm. But I have a folder called John's folder on my MacBook so when I attempt to copy a file inside that directory like
scp macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder



It throws back an error



unexpected EOF error while looking for matching `’`


and



unexpected end of file


How do I resolve this?







share|improve this question





















  • Try using double quotes instead: scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder". But also just don't give files/directories such crazy names.
    – Jesse_b
    Apr 19 at 18:23















up vote
3
down vote

favorite
1












I use scp to transfer files from my android to my MacBook which works like a charm. But I have a folder called John's folder on my MacBook so when I attempt to copy a file inside that directory like
scp macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder



It throws back an error



unexpected EOF error while looking for matching `’`


and



unexpected end of file


How do I resolve this?







share|improve this question





















  • Try using double quotes instead: scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder". But also just don't give files/directories such crazy names.
    – Jesse_b
    Apr 19 at 18:23













up vote
3
down vote

favorite
1









up vote
3
down vote

favorite
1






1





I use scp to transfer files from my android to my MacBook which works like a charm. But I have a folder called John's folder on my MacBook so when I attempt to copy a file inside that directory like
scp macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder



It throws back an error



unexpected EOF error while looking for matching `’`


and



unexpected end of file


How do I resolve this?







share|improve this question













I use scp to transfer files from my android to my MacBook which works like a charm. But I have a folder called John's folder on my MacBook so when I attempt to copy a file inside that directory like
scp macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder



It throws back an error



unexpected EOF error while looking for matching `’`


and



unexpected end of file


How do I resolve this?









share|improve this question












share|improve this question




share|improve this question








edited Apr 20 at 6:55









roaima

39.4k545106




39.4k545106









asked Apr 19 at 18:20









nobody user

1183




1183











  • Try using double quotes instead: scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder". But also just don't give files/directories such crazy names.
    – Jesse_b
    Apr 19 at 18:23

















  • Try using double quotes instead: scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder". But also just don't give files/directories such crazy names.
    – Jesse_b
    Apr 19 at 18:23
















Try using double quotes instead: scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder". But also just don't give files/directories such crazy names.
– Jesse_b
Apr 19 at 18:23





Try using double quotes instead: scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder". But also just don't give files/directories such crazy names.
– Jesse_b
Apr 19 at 18:23











2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










This is interesting. The other answers that I'm seeing are telling you to swap your escaped quote and escaped space for a quoted string. Actually they're equivalent so you'll see no change (a' b is the same to the shell as "a' b").



The problem here lies in the way that scp on the remote system interprets the command line that it's being given.



As an example, this would work:



scp John's folder/file localhost:/tmp/dst


But this would fail:



scp localhost:/tmp/src/John's folder/file /tmp/dst


(I've used localhost for the example; you should use user@host for your situation.)



If you include the -v (verbose) flag on scp you can see exactly what's going on that gives rise to the failure:



debug1: Sending command: scp -v -f /tmp/src/John's folder/file
bash: -c: line 0: unexpected EOF while looking for matching `''
bash: -c: line 1: syntax error: unexpected end of file


The unfortunate solution here is that you need to escape special characters (including whitespace) twice - once for the local shell, and once for the remote shell:



scp localhost:"/tmp/src/John's folder/file" /tmp/dst





share|improve this answer






























    up vote
    0
    down vote













    SCP needs to include one entire parameter in quotations. 2 different answers before me are partially right, but the correct answer is



    scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file" storage/folder



    Notice that the first parameter is wrapped in quotes, but not the second - if both were wrapped in a single instance of quotations as one comments suggests, the /bin/scp would invoke this as a single parameter, and be expecting another parameter after that.



    scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder" will be read as a single parameter. Even though there is a space there, the double quotes escape that.



    Finally, putting quotations in the middle of a parameter like scp macbook@192.168.0.3:"/Users/macbook/desktop/John's folder/file" storage/folder cuts the paarameter in half and won't make sense to the shell because user@host:/path/to/directory is one full parameter. You can use parts of it, but you cannot cut it in half or it will be examined as 2 different params.






    share|improve this answer





















    • Changing quotes within a token (aka word) works fine in any POSIX shell. Example (in bash): foo=bar; echo fine'$foo'more"$foo" -> fine$foomorebar
      – dave_thompson_085
      Apr 20 at 7:35











    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f438791%2fscp-error-while-attempting-to-copy-files%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote



    accepted










    This is interesting. The other answers that I'm seeing are telling you to swap your escaped quote and escaped space for a quoted string. Actually they're equivalent so you'll see no change (a' b is the same to the shell as "a' b").



    The problem here lies in the way that scp on the remote system interprets the command line that it's being given.



    As an example, this would work:



    scp John's folder/file localhost:/tmp/dst


    But this would fail:



    scp localhost:/tmp/src/John's folder/file /tmp/dst


    (I've used localhost for the example; you should use user@host for your situation.)



    If you include the -v (verbose) flag on scp you can see exactly what's going on that gives rise to the failure:



    debug1: Sending command: scp -v -f /tmp/src/John's folder/file
    bash: -c: line 0: unexpected EOF while looking for matching `''
    bash: -c: line 1: syntax error: unexpected end of file


    The unfortunate solution here is that you need to escape special characters (including whitespace) twice - once for the local shell, and once for the remote shell:



    scp localhost:"/tmp/src/John's folder/file" /tmp/dst





    share|improve this answer



























      up vote
      2
      down vote



      accepted










      This is interesting. The other answers that I'm seeing are telling you to swap your escaped quote and escaped space for a quoted string. Actually they're equivalent so you'll see no change (a' b is the same to the shell as "a' b").



      The problem here lies in the way that scp on the remote system interprets the command line that it's being given.



      As an example, this would work:



      scp John's folder/file localhost:/tmp/dst


      But this would fail:



      scp localhost:/tmp/src/John's folder/file /tmp/dst


      (I've used localhost for the example; you should use user@host for your situation.)



      If you include the -v (verbose) flag on scp you can see exactly what's going on that gives rise to the failure:



      debug1: Sending command: scp -v -f /tmp/src/John's folder/file
      bash: -c: line 0: unexpected EOF while looking for matching `''
      bash: -c: line 1: syntax error: unexpected end of file


      The unfortunate solution here is that you need to escape special characters (including whitespace) twice - once for the local shell, and once for the remote shell:



      scp localhost:"/tmp/src/John's folder/file" /tmp/dst





      share|improve this answer

























        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        This is interesting. The other answers that I'm seeing are telling you to swap your escaped quote and escaped space for a quoted string. Actually they're equivalent so you'll see no change (a' b is the same to the shell as "a' b").



        The problem here lies in the way that scp on the remote system interprets the command line that it's being given.



        As an example, this would work:



        scp John's folder/file localhost:/tmp/dst


        But this would fail:



        scp localhost:/tmp/src/John's folder/file /tmp/dst


        (I've used localhost for the example; you should use user@host for your situation.)



        If you include the -v (verbose) flag on scp you can see exactly what's going on that gives rise to the failure:



        debug1: Sending command: scp -v -f /tmp/src/John's folder/file
        bash: -c: line 0: unexpected EOF while looking for matching `''
        bash: -c: line 1: syntax error: unexpected end of file


        The unfortunate solution here is that you need to escape special characters (including whitespace) twice - once for the local shell, and once for the remote shell:



        scp localhost:"/tmp/src/John's folder/file" /tmp/dst





        share|improve this answer















        This is interesting. The other answers that I'm seeing are telling you to swap your escaped quote and escaped space for a quoted string. Actually they're equivalent so you'll see no change (a' b is the same to the shell as "a' b").



        The problem here lies in the way that scp on the remote system interprets the command line that it's being given.



        As an example, this would work:



        scp John's folder/file localhost:/tmp/dst


        But this would fail:



        scp localhost:/tmp/src/John's folder/file /tmp/dst


        (I've used localhost for the example; you should use user@host for your situation.)



        If you include the -v (verbose) flag on scp you can see exactly what's going on that gives rise to the failure:



        debug1: Sending command: scp -v -f /tmp/src/John's folder/file
        bash: -c: line 0: unexpected EOF while looking for matching `''
        bash: -c: line 1: syntax error: unexpected end of file


        The unfortunate solution here is that you need to escape special characters (including whitespace) twice - once for the local shell, and once for the remote shell:



        scp localhost:"/tmp/src/John's folder/file" /tmp/dst






        share|improve this answer















        share|improve this answer



        share|improve this answer








        edited Apr 19 at 19:45


























        answered Apr 19 at 19:38









        roaima

        39.4k545106




        39.4k545106






















            up vote
            0
            down vote













            SCP needs to include one entire parameter in quotations. 2 different answers before me are partially right, but the correct answer is



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file" storage/folder



            Notice that the first parameter is wrapped in quotes, but not the second - if both were wrapped in a single instance of quotations as one comments suggests, the /bin/scp would invoke this as a single parameter, and be expecting another parameter after that.



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder" will be read as a single parameter. Even though there is a space there, the double quotes escape that.



            Finally, putting quotations in the middle of a parameter like scp macbook@192.168.0.3:"/Users/macbook/desktop/John's folder/file" storage/folder cuts the paarameter in half and won't make sense to the shell because user@host:/path/to/directory is one full parameter. You can use parts of it, but you cannot cut it in half or it will be examined as 2 different params.






            share|improve this answer





















            • Changing quotes within a token (aka word) works fine in any POSIX shell. Example (in bash): foo=bar; echo fine'$foo'more"$foo" -> fine$foomorebar
              – dave_thompson_085
              Apr 20 at 7:35















            up vote
            0
            down vote













            SCP needs to include one entire parameter in quotations. 2 different answers before me are partially right, but the correct answer is



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file" storage/folder



            Notice that the first parameter is wrapped in quotes, but not the second - if both were wrapped in a single instance of quotations as one comments suggests, the /bin/scp would invoke this as a single parameter, and be expecting another parameter after that.



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder" will be read as a single parameter. Even though there is a space there, the double quotes escape that.



            Finally, putting quotations in the middle of a parameter like scp macbook@192.168.0.3:"/Users/macbook/desktop/John's folder/file" storage/folder cuts the paarameter in half and won't make sense to the shell because user@host:/path/to/directory is one full parameter. You can use parts of it, but you cannot cut it in half or it will be examined as 2 different params.






            share|improve this answer





















            • Changing quotes within a token (aka word) works fine in any POSIX shell. Example (in bash): foo=bar; echo fine'$foo'more"$foo" -> fine$foomorebar
              – dave_thompson_085
              Apr 20 at 7:35













            up vote
            0
            down vote










            up vote
            0
            down vote









            SCP needs to include one entire parameter in quotations. 2 different answers before me are partially right, but the correct answer is



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file" storage/folder



            Notice that the first parameter is wrapped in quotes, but not the second - if both were wrapped in a single instance of quotations as one comments suggests, the /bin/scp would invoke this as a single parameter, and be expecting another parameter after that.



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder" will be read as a single parameter. Even though there is a space there, the double quotes escape that.



            Finally, putting quotations in the middle of a parameter like scp macbook@192.168.0.3:"/Users/macbook/desktop/John's folder/file" storage/folder cuts the paarameter in half and won't make sense to the shell because user@host:/path/to/directory is one full parameter. You can use parts of it, but you cannot cut it in half or it will be examined as 2 different params.






            share|improve this answer













            SCP needs to include one entire parameter in quotations. 2 different answers before me are partially right, but the correct answer is



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file" storage/folder



            Notice that the first parameter is wrapped in quotes, but not the second - if both were wrapped in a single instance of quotations as one comments suggests, the /bin/scp would invoke this as a single parameter, and be expecting another parameter after that.



            scp "macbook@192.168.0.3:/Users/macbook/desktop/John's folder/file storage/folder" will be read as a single parameter. Even though there is a space there, the double quotes escape that.



            Finally, putting quotations in the middle of a parameter like scp macbook@192.168.0.3:"/Users/macbook/desktop/John's folder/file" storage/folder cuts the paarameter in half and won't make sense to the shell because user@host:/path/to/directory is one full parameter. You can use parts of it, but you cannot cut it in half or it will be examined as 2 different params.







            share|improve this answer













            share|improve this answer



            share|improve this answer











            answered Apr 19 at 19:09









            SomeGuy

            212112




            212112











            • Changing quotes within a token (aka word) works fine in any POSIX shell. Example (in bash): foo=bar; echo fine'$foo'more"$foo" -> fine$foomorebar
              – dave_thompson_085
              Apr 20 at 7:35

















            • Changing quotes within a token (aka word) works fine in any POSIX shell. Example (in bash): foo=bar; echo fine'$foo'more"$foo" -> fine$foomorebar
              – dave_thompson_085
              Apr 20 at 7:35
















            Changing quotes within a token (aka word) works fine in any POSIX shell. Example (in bash): foo=bar; echo fine'$foo'more"$foo" -> fine$foomorebar
            – dave_thompson_085
            Apr 20 at 7:35





            Changing quotes within a token (aka word) works fine in any POSIX shell. Example (in bash): foo=bar; echo fine'$foo'more"$foo" -> fine$foomorebar
            – dave_thompson_085
            Apr 20 at 7:35













             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f438791%2fscp-error-while-attempting-to-copy-files%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?