Download directory structure from a TFTP server

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











up vote
5
down vote

favorite
1












I need to download the complete directory structure from a TFTP server. Is there some simple way to do that? If that is not possible, than how could I download all files individually (provided I have a list of all files on the server)?










share|improve this question



























    up vote
    5
    down vote

    favorite
    1












    I need to download the complete directory structure from a TFTP server. Is there some simple way to do that? If that is not possible, than how could I download all files individually (provided I have a list of all files on the server)?










    share|improve this question

























      up vote
      5
      down vote

      favorite
      1









      up vote
      5
      down vote

      favorite
      1






      1





      I need to download the complete directory structure from a TFTP server. Is there some simple way to do that? If that is not possible, than how could I download all files individually (provided I have a list of all files on the server)?










      share|improve this question















      I need to download the complete directory structure from a TFTP server. Is there some simple way to do that? If that is not possible, than how could I download all files individually (provided I have a list of all files on the server)?







      tftp






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited May 19 '13 at 21:44









      vonbrand

      14k22444




      14k22444










      asked May 19 '13 at 21:08









      user1968963

      93692345




      93692345




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          You cannot list files or directories with TFTP. Read first paragraph of RFC 1350 - 1. Purpose. (or better yet, read the whole document.)



          If you have a file list in say files.txt you can use expect, curl or other to automate a download. Simple example (as a starter) using curl:



          tftpbatch:



          #!/bin/bash

          server="tftp://$2"

          while IFS= read -r path; do
          [[ "$path" =~ ^ *$ ]] && continue
          dir="$(dirname "$path")"
          printf "GET %s => %sn" "$path" "$dir"
          ! [ -d "$dir" ] && mkdir -p "$dir"
          curl -o "$path" "$server/$path"
          done < "$1"


          Run with:



          ./tftpbatch files.txt "10.0.0.5:69"





          share|improve this answer






















            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: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            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%2f76400%2fdownload-directory-structure-from-a-tftp-server%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            6
            down vote



            accepted










            You cannot list files or directories with TFTP. Read first paragraph of RFC 1350 - 1. Purpose. (or better yet, read the whole document.)



            If you have a file list in say files.txt you can use expect, curl or other to automate a download. Simple example (as a starter) using curl:



            tftpbatch:



            #!/bin/bash

            server="tftp://$2"

            while IFS= read -r path; do
            [[ "$path" =~ ^ *$ ]] && continue
            dir="$(dirname "$path")"
            printf "GET %s => %sn" "$path" "$dir"
            ! [ -d "$dir" ] && mkdir -p "$dir"
            curl -o "$path" "$server/$path"
            done < "$1"


            Run with:



            ./tftpbatch files.txt "10.0.0.5:69"





            share|improve this answer


























              up vote
              6
              down vote



              accepted










              You cannot list files or directories with TFTP. Read first paragraph of RFC 1350 - 1. Purpose. (or better yet, read the whole document.)



              If you have a file list in say files.txt you can use expect, curl or other to automate a download. Simple example (as a starter) using curl:



              tftpbatch:



              #!/bin/bash

              server="tftp://$2"

              while IFS= read -r path; do
              [[ "$path" =~ ^ *$ ]] && continue
              dir="$(dirname "$path")"
              printf "GET %s => %sn" "$path" "$dir"
              ! [ -d "$dir" ] && mkdir -p "$dir"
              curl -o "$path" "$server/$path"
              done < "$1"


              Run with:



              ./tftpbatch files.txt "10.0.0.5:69"





              share|improve this answer
























                up vote
                6
                down vote



                accepted







                up vote
                6
                down vote



                accepted






                You cannot list files or directories with TFTP. Read first paragraph of RFC 1350 - 1. Purpose. (or better yet, read the whole document.)



                If you have a file list in say files.txt you can use expect, curl or other to automate a download. Simple example (as a starter) using curl:



                tftpbatch:



                #!/bin/bash

                server="tftp://$2"

                while IFS= read -r path; do
                [[ "$path" =~ ^ *$ ]] && continue
                dir="$(dirname "$path")"
                printf "GET %s => %sn" "$path" "$dir"
                ! [ -d "$dir" ] && mkdir -p "$dir"
                curl -o "$path" "$server/$path"
                done < "$1"


                Run with:



                ./tftpbatch files.txt "10.0.0.5:69"





                share|improve this answer














                You cannot list files or directories with TFTP. Read first paragraph of RFC 1350 - 1. Purpose. (or better yet, read the whole document.)



                If you have a file list in say files.txt you can use expect, curl or other to automate a download. Simple example (as a starter) using curl:



                tftpbatch:



                #!/bin/bash

                server="tftp://$2"

                while IFS= read -r path; do
                [[ "$path" =~ ^ *$ ]] && continue
                dir="$(dirname "$path")"
                printf "GET %s => %sn" "$path" "$dir"
                ! [ -d "$dir" ] && mkdir -p "$dir"
                curl -o "$path" "$server/$path"
                done < "$1"


                Run with:



                ./tftpbatch files.txt "10.0.0.5:69"






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 31 mins ago









                evandrix

                10514




                10514










                answered May 20 '13 at 4:53









                Runium

                17.7k42859




                17.7k42859



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f76400%2fdownload-directory-structure-from-a-tftp-server%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)