Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:43:53+00:00 2026-06-12T07:43:53+00:00

I only want the folder structure, but I couldn’t figure out how with wget.

  • 0

I only want the folder structure, but I couldn’t figure out how with wget. Instead I am using this:

wget -R pdf,css,gif,txt,png -np -r http://example.com

Which should reject all the files after -R, but it seems to me wget still downloads the file, then deletes it.

Is there a better way to just get the folder structure?

TTP request sent, awaiting response…
200 OK Length: 136796 (134K)
[application/x-download] Saving to:
“example.com/file.pdf”

100%[=====================================>] 136,796 853K/s in 0.2s

2012-10-03 03:51:41 (853 KB/s) –
“example.com/file.pdf”
saved [136796/136796]

Removing
example.com/file.pdf since it should be rejected.

If anyone was wondering this is for a client which they can tell me the structure but it’s a hassle since their IT guy has to do it, so I wanted to just get it myself.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:43:54+00:00Added an answer on June 12, 2026 at 7:43 am

    That appears to be how wget was designed to work. When performing recursive downloads, non-leaf files that match the reject list are still downloaded so they can be harvested for links, then deleted.

    From the in-code comments (recur.c):

    Either –delete-after was specified, or we loaded this
    otherwise rejected (e.g. by -R) HTML file just so we
    could harvest its hyperlinks
    — in either case, delete
    the local file.

    We’ve had a run-in with this in a past project where we had to mirror an authenticated site and wget keeps hitting the logout pages even when it was meant to reject those URLs. We could not find any options to change the behaviour of wget.

    The solution we ended up with was to download, hack and build our own version of wget. There’s probably a more elegant approach to this, but the quick fix we used was to add the following rules to the end of the download_child_p() routine (modified to match your requirements):

      /* Extra rules */
      if (match_tail(url, ".pdf", 0)) goto out;
      if (match_tail(url, ".css", 0)) goto out;
      if (match_tail(url, ".gif", 0)) goto out;
      if (match_tail(url, ".txt", 0)) goto out;
      if (match_tail(url, ".png", 0)) goto out;
      /* --- end extra rules --- */
    
      /* The URL has passed all the tests.  It can be placed in the
         download queue. */
      DEBUGP (("Decided to load it.\n"));
    
      return 1;
    
     out:
      DEBUGP (("Decided NOT to load it.\n"));
    
      return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Copy to Output Directory copies folder structure but only want to copy
Possible Duplicate: Copy to Output Directory copies folder structure but only want to copy
I want to be able to replicate only the folder structure (not the contents)
I want to add recursivly new file. This is folder structure a/b/c/d/e. When i
I only want this function to run if .toolbar li does not have the
I have some SVN projects with this folder structure project/trunk/ project/branches/1.x project/branches/2.x project/branches/3.x First
I have this folder structure: package/ __init__.py misc/ __init__.py tools.py subpackage/ __init__.py submodule.py I
I have this massive folder structure with thousands of folders and subfolders. I need
I currently have this folder structure: img.domain.com/ boats/ boat1/ 1.jpg 2.jpg trees/ tree1/ 1.jpg
I've got a php file inside this folder structure: Web -> script -> gen.php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.