Using wget on a directory outside the user's home directory

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











up vote
0
down vote

favorite












I'm trying to mirror a directory via FTP with wget. The command I'm using is



wget -m ftp://user:pass@192.168.1.1/foo/bar/


But, when I run it, I get the following:



--2018-10-10 15:01:32-- ftp://user:*password*@192.168.1.1/foo/bar/
=> ‘192.168.3.150/foo/bar/.listing’
Connecting to 192.168.1.1:21... connected.
Logging in as user ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD (1) /usr/user/foo/bar ...
No such directory ‘foo/bar’.


I've searched the man pages, and googled, and I can't figure it out. How do I make wget actually download the directory "/foo/bar/", and not "/usr/user/foo/bar/"?










share|improve this question

























    up vote
    0
    down vote

    favorite












    I'm trying to mirror a directory via FTP with wget. The command I'm using is



    wget -m ftp://user:pass@192.168.1.1/foo/bar/


    But, when I run it, I get the following:



    --2018-10-10 15:01:32-- ftp://user:*password*@192.168.1.1/foo/bar/
    => ‘192.168.3.150/foo/bar/.listing’
    Connecting to 192.168.1.1:21... connected.
    Logging in as user ... Logged in!
    ==> SYST ... done. ==> PWD ... done.
    ==> TYPE I ... done. ==> CWD (1) /usr/user/foo/bar ...
    No such directory ‘foo/bar’.


    I've searched the man pages, and googled, and I can't figure it out. How do I make wget actually download the directory "/foo/bar/", and not "/usr/user/foo/bar/"?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I'm trying to mirror a directory via FTP with wget. The command I'm using is



      wget -m ftp://user:pass@192.168.1.1/foo/bar/


      But, when I run it, I get the following:



      --2018-10-10 15:01:32-- ftp://user:*password*@192.168.1.1/foo/bar/
      => ‘192.168.3.150/foo/bar/.listing’
      Connecting to 192.168.1.1:21... connected.
      Logging in as user ... Logged in!
      ==> SYST ... done. ==> PWD ... done.
      ==> TYPE I ... done. ==> CWD (1) /usr/user/foo/bar ...
      No such directory ‘foo/bar’.


      I've searched the man pages, and googled, and I can't figure it out. How do I make wget actually download the directory "/foo/bar/", and not "/usr/user/foo/bar/"?










      share|improve this question













      I'm trying to mirror a directory via FTP with wget. The command I'm using is



      wget -m ftp://user:pass@192.168.1.1/foo/bar/


      But, when I run it, I get the following:



      --2018-10-10 15:01:32-- ftp://user:*password*@192.168.1.1/foo/bar/
      => ‘192.168.3.150/foo/bar/.listing’
      Connecting to 192.168.1.1:21... connected.
      Logging in as user ... Logged in!
      ==> SYST ... done. ==> PWD ... done.
      ==> TYPE I ... done. ==> CWD (1) /usr/user/foo/bar ...
      No such directory ‘foo/bar’.


      I've searched the man pages, and googled, and I can't figure it out. How do I make wget actually download the directory "/foo/bar/", and not "/usr/user/foo/bar/"?







      wget ftp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 44 mins ago









      HiddenWindshield

      313




      313




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          A similar question on stackoverflow (which involved java instead of wget, but really the underlying problem is with the URL syntax which is hopefully language-independent) was resolved by adding another slash and URL-encoding it, like this:



          wget -m ftp://user:pass@192.168.1.1/%2Ffoo/bar/


          It works for me even without encoding, just with an extra slash:



          wget -m ftp://user:pass@192.168.1.1//foo/bar/


          The first slash is thrown away (serving only as a separator between host and path), and the second slash actually counts as part of the path.





          share



























            up vote
            0
            down vote













            You should be able to download a specific directory using wget like this:



            wget -m 'ftp://[user]@192.168.1.1/%2ffoo/bar' -O /foo/bar


            I would avoid putting your password into the URL as it will then appear in your bash history. This command of course means that /foo/bar is located off of / and not anywhere else. If /foo/bar is located off of something like /var/www you will need to include the full path in the command.



            I take it you are using a UNIX-like based off of the /usr/user so there may be differences in the function of the specific implementation of wget you are using.



            Here is an alternative using curl:



            curl -u [user] 'ftp://192.168.1.1/%2fpath/to/foo/bar' -o /path/to/foo/bar


            Please read over these links:



            FTP URLs
            How to use wget
            Using wget to recursively download FTP directories
            Download using wget to a different directory than current directory
            How to specify the location with wget?
            Downloading file from FTP using cURL



            Please comment if you have any questions or issues with this answer. I highly suggest you read through each link I have provided thoroughly before attempting the commands. I appreciate feedback to correct any misconceptions and to improve my posts. I can update my answer as needed.



            Best of Luck!





            share




















              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%2f474642%2fusing-wget-on-a-directory-outside-the-users-home-directory%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
              0
              down vote













              A similar question on stackoverflow (which involved java instead of wget, but really the underlying problem is with the URL syntax which is hopefully language-independent) was resolved by adding another slash and URL-encoding it, like this:



              wget -m ftp://user:pass@192.168.1.1/%2Ffoo/bar/


              It works for me even without encoding, just with an extra slash:



              wget -m ftp://user:pass@192.168.1.1//foo/bar/


              The first slash is thrown away (serving only as a separator between host and path), and the second slash actually counts as part of the path.





              share
























                up vote
                0
                down vote













                A similar question on stackoverflow (which involved java instead of wget, but really the underlying problem is with the URL syntax which is hopefully language-independent) was resolved by adding another slash and URL-encoding it, like this:



                wget -m ftp://user:pass@192.168.1.1/%2Ffoo/bar/


                It works for me even without encoding, just with an extra slash:



                wget -m ftp://user:pass@192.168.1.1//foo/bar/


                The first slash is thrown away (serving only as a separator between host and path), and the second slash actually counts as part of the path.





                share






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  A similar question on stackoverflow (which involved java instead of wget, but really the underlying problem is with the URL syntax which is hopefully language-independent) was resolved by adding another slash and URL-encoding it, like this:



                  wget -m ftp://user:pass@192.168.1.1/%2Ffoo/bar/


                  It works for me even without encoding, just with an extra slash:



                  wget -m ftp://user:pass@192.168.1.1//foo/bar/


                  The first slash is thrown away (serving only as a separator between host and path), and the second slash actually counts as part of the path.





                  share












                  A similar question on stackoverflow (which involved java instead of wget, but really the underlying problem is with the URL syntax which is hopefully language-independent) was resolved by adding another slash and URL-encoding it, like this:



                  wget -m ftp://user:pass@192.168.1.1/%2Ffoo/bar/


                  It works for me even without encoding, just with an extra slash:



                  wget -m ftp://user:pass@192.168.1.1//foo/bar/


                  The first slash is thrown away (serving only as a separator between host and path), and the second slash actually counts as part of the path.






                  share











                  share


                  share










                  answered 2 mins ago









                  Wumpus Q. Wumbley

                  4,0401120




                  4,0401120






















                      up vote
                      0
                      down vote













                      You should be able to download a specific directory using wget like this:



                      wget -m 'ftp://[user]@192.168.1.1/%2ffoo/bar' -O /foo/bar


                      I would avoid putting your password into the URL as it will then appear in your bash history. This command of course means that /foo/bar is located off of / and not anywhere else. If /foo/bar is located off of something like /var/www you will need to include the full path in the command.



                      I take it you are using a UNIX-like based off of the /usr/user so there may be differences in the function of the specific implementation of wget you are using.



                      Here is an alternative using curl:



                      curl -u [user] 'ftp://192.168.1.1/%2fpath/to/foo/bar' -o /path/to/foo/bar


                      Please read over these links:



                      FTP URLs
                      How to use wget
                      Using wget to recursively download FTP directories
                      Download using wget to a different directory than current directory
                      How to specify the location with wget?
                      Downloading file from FTP using cURL



                      Please comment if you have any questions or issues with this answer. I highly suggest you read through each link I have provided thoroughly before attempting the commands. I appreciate feedback to correct any misconceptions and to improve my posts. I can update my answer as needed.



                      Best of Luck!





                      share
























                        up vote
                        0
                        down vote













                        You should be able to download a specific directory using wget like this:



                        wget -m 'ftp://[user]@192.168.1.1/%2ffoo/bar' -O /foo/bar


                        I would avoid putting your password into the URL as it will then appear in your bash history. This command of course means that /foo/bar is located off of / and not anywhere else. If /foo/bar is located off of something like /var/www you will need to include the full path in the command.



                        I take it you are using a UNIX-like based off of the /usr/user so there may be differences in the function of the specific implementation of wget you are using.



                        Here is an alternative using curl:



                        curl -u [user] 'ftp://192.168.1.1/%2fpath/to/foo/bar' -o /path/to/foo/bar


                        Please read over these links:



                        FTP URLs
                        How to use wget
                        Using wget to recursively download FTP directories
                        Download using wget to a different directory than current directory
                        How to specify the location with wget?
                        Downloading file from FTP using cURL



                        Please comment if you have any questions or issues with this answer. I highly suggest you read through each link I have provided thoroughly before attempting the commands. I appreciate feedback to correct any misconceptions and to improve my posts. I can update my answer as needed.



                        Best of Luck!





                        share






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          You should be able to download a specific directory using wget like this:



                          wget -m 'ftp://[user]@192.168.1.1/%2ffoo/bar' -O /foo/bar


                          I would avoid putting your password into the URL as it will then appear in your bash history. This command of course means that /foo/bar is located off of / and not anywhere else. If /foo/bar is located off of something like /var/www you will need to include the full path in the command.



                          I take it you are using a UNIX-like based off of the /usr/user so there may be differences in the function of the specific implementation of wget you are using.



                          Here is an alternative using curl:



                          curl -u [user] 'ftp://192.168.1.1/%2fpath/to/foo/bar' -o /path/to/foo/bar


                          Please read over these links:



                          FTP URLs
                          How to use wget
                          Using wget to recursively download FTP directories
                          Download using wget to a different directory than current directory
                          How to specify the location with wget?
                          Downloading file from FTP using cURL



                          Please comment if you have any questions or issues with this answer. I highly suggest you read through each link I have provided thoroughly before attempting the commands. I appreciate feedback to correct any misconceptions and to improve my posts. I can update my answer as needed.



                          Best of Luck!





                          share












                          You should be able to download a specific directory using wget like this:



                          wget -m 'ftp://[user]@192.168.1.1/%2ffoo/bar' -O /foo/bar


                          I would avoid putting your password into the URL as it will then appear in your bash history. This command of course means that /foo/bar is located off of / and not anywhere else. If /foo/bar is located off of something like /var/www you will need to include the full path in the command.



                          I take it you are using a UNIX-like based off of the /usr/user so there may be differences in the function of the specific implementation of wget you are using.



                          Here is an alternative using curl:



                          curl -u [user] 'ftp://192.168.1.1/%2fpath/to/foo/bar' -o /path/to/foo/bar


                          Please read over these links:



                          FTP URLs
                          How to use wget
                          Using wget to recursively download FTP directories
                          Download using wget to a different directory than current directory
                          How to specify the location with wget?
                          Downloading file from FTP using cURL



                          Please comment if you have any questions or issues with this answer. I highly suggest you read through each link I have provided thoroughly before attempting the commands. I appreciate feedback to correct any misconceptions and to improve my posts. I can update my answer as needed.



                          Best of Luck!






                          share











                          share


                          share










                          answered 2 mins ago









                          kemotep

                          1,7862617




                          1,7862617



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474642%2fusing-wget-on-a-directory-outside-the-users-home-directory%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?