{"id":1,"date":"2023-01-18T14:41:37","date_gmt":"2023-01-18T14:41:37","guid":{"rendered":"https:\/\/raymundopizano.com\/blog\/?p=1"},"modified":"2025-03-05T22:02:32","modified_gmt":"2025-03-05T22:02:32","slug":"hello-world","status":"publish","type":"post","link":"https:\/\/raymundopizano.com\/blog\/tutorial\/hello-world\/","title":{"rendered":"Descargar recursivamente todos los archivos y directorios enlistados en un directorio web con wget"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Cuantas veces hemos querido facilitarnos el trabajo de descargar los archivos enlistados en un servidor web incluyendo sus subdirectorios., por ejemplo descargar desde <a href=\"https:\/\/archive.org\/download\/No-Intro-Collection_2016-01-03_Fixed\">https:\/\/archive.org\/download\/No-Intro-Collection_2016-01-03_Fixed<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"760\" height=\"640\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/listdir.png\" alt=\"\" class=\"wp-image-7\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/listdir.png 760w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/listdir-300x253.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/listdir-700x589.png 700w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><figcaption class=\"wp-element-caption\">Listado de archivos contenidos en el directorio<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>La soluci\u00f3n para ello es usar wget.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"wget -c -r -np -nH \u2013cut-dirs=1 -R index.html https:\/\/archive.org\/download\/No-Intro-Collection_2016-01-03_Fixed\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #A6E22E\">wget<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">-c<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">-r<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">-np<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">-nH<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">\u2013cut-dirs=<\/span><span style=\"color: #AE81FF\">1<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">-R<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">index.html<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">https:\/\/archive.org\/download\/No-Intro-Collection_2016-01-03_Fixed<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Descargara todos los archivos y subdirectorios contenidos en la carpeta  https:\/\/archive.org\/download\/No-Intro-Collection_2016-01-03_Fixed <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Las opciones:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>-c<\/strong> Continuar en caso de un apag\u00f3n de luz y de que internet se corte podemos reiniciar donde nos quedamos<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>-r<\/em><\/strong> Recursivo<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>-np <\/em><\/strong>No contemplar los directorios superiores (para este ejemplo &lt;&lt;download&gt;&gt;)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>-nH<\/em><\/strong> no guardar archivos en la carpeta del nombre de host (es decir no creara un directorio download en nuestro equipo)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>-cut-dirs=1 <\/em><\/strong>para la carpeta  No-Intro-Collection_2016-01-03_Fixed omitiendo la primera carpeta download (aqui agregar cuantas carpetas nos gustar\u00eda ignorar \/a\/b\/c\/etc)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><em>-R index.html<\/em><\/strong> excluye el archivo index.html (el cual es el listado de los archivos mostrados en la imagen anterior)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>wget <\/strong>es nativo en GNU \/ Linux, en Windows sugiero instalar Windows Subsystem for Linux<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"573\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/wget_win2_wls-1024x573.png\" alt=\"\" class=\"wp-image-11\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/wget_win2_wls-1024x573.png 1024w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/wget_win2_wls-300x168.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/wget_win2_wls-768x430.png 768w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/wget_win2_wls-700x392.png 700w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/wget_win2_wls.png 1115w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">En MacOS instala el gestor de paquetes <a href=\"https:\/\/brew.sh\/index_es\">Brew<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"538\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/brewpage.png\" alt=\"\" class=\"wp-image-15\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/brewpage.png 761w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/brewpage-300x212.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/brewpage-700x495.png 700w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Copia el texto de la linea de comandos<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"891\" height=\"555\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.13.00.png\" alt=\"\" class=\"wp-image-17\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.13.00.png 891w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.13.00-300x187.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.13.00-768x478.png 768w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.13.00-700x436.png 700w\" sizes=\"auto, (max-width: 891px) 100vw, 891px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Ejecuta Terminal y pega los comandos., ingresa tu contrase\u00f1a de la Mac y por ultimo presiona Enter<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"890\" height=\"555\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.17.46.png\" alt=\"\" class=\"wp-image-18\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.17.46.png 890w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.17.46-300x187.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.17.46-768x479.png 768w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.17.46-700x437.png 700w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><figcaption class=\"wp-element-caption\">Proceso terminado<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"894\" height=\"90\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.19.19.png\" alt=\"\" class=\"wp-image-19\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.19.19.png 894w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.19.19-300x30.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.19.19-768x77.png 768w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2023\/01\/Captura-de-Pantalla-2021-05-18-a-las-16.19.19-700x70.png 700w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Instalamos wget con los siguientes comandos:<br><strong><code>brew install wget<\/code><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Wget descargar todos los enlaces dentro de una archivo de texto <\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">He creado un archivo de texto con los enlaces de los archivos que quiero descargar y lo guarde como archivos.txt<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"937\" height=\"390\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget_txt.png\" alt=\"\" class=\"wp-image-855\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget_txt.png 937w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget_txt-300x125.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget_txt-768x320.png 768w\" sizes=\"auto, (max-width: 937px) 100vw, 937px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Ahora para descargarlo me ubico en la misma carpeta que el archivo de texto y escribo en la l\u00ednea de comandos:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#F8F8F2;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#272822\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"wget -i archivos.txt\" style=\"color:#F8F8F2;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki monokai\" style=\"background-color: #272822\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #A6E22E\">wget<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #AE81FF\">-i<\/span><span style=\"color: #F8F8F2\"> <\/span><span style=\"color: #E6DB74\">archivos.txt<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"454\" src=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget-iarchivos.png\" alt=\"\" class=\"wp-image-856\" srcset=\"https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget-iarchivos.png 774w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget-iarchivos-300x176.png 300w, https:\/\/raymundopizano.com\/blog\/wp-content\/uploads\/2024\/02\/wget-iarchivos-768x450.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Cuantas veces hemos querido facilitarnos el trabajo de descargar los archivos enlistados en un servidor web incluyendo sus subdirectorios., por ejemplo descargar desde https:\/\/archive.org\/download\/No-Intro-Collection_2016-01-03_Fixed La soluci\u00f3n para ello es usar wget. Descargara todos los archivos y subdirectorios contenidos en la carpeta https:\/\/archive.org\/download\/No-Intro-Collection_2016-01-03_Fixed Las opciones: -c Continuar en caso de un apag\u00f3n de luz y de [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"_links":{"self":[{"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/comments?post=1"}],"version-history":[{"count":18,"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":2015,"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/posts\/1\/revisions\/2015"}],"wp:attachment":[{"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/media?parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/categories?post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raymundopizano.com\/blog\/wp-json\/wp\/v2\/tags?post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}