LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-01-2012, 05:10 PM   #1
corepuncher
LQ Newbie
 
Registered: Feb 2005
Location: Norman, OK
Distribution: Fedora Core 3
Posts: 13

Rep: Reputation: 0
Simple WGET Question


I have a url http://www.url.com/dir1/dir2/dir3/dir4

I want to download all the files in that dir with wget. All csv files. *.csv does not work.

I tried google search but everyone wants to give me all sorts of options that do other things. Shouldn't this be really easy? Thanks.
 
Old 11-01-2012, 05:26 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
You don't necessarily know what files are there to download, you can't literally just request a wildcard.

you can use the -r option to download recursively, try a full command like "wget -r -l1 --no-parent -A.csv domain.com/a/b/c"

alternatively, curl is useful for downloading patterns of files like [000-999].csv would cover those 1000 files explicitly.
 
Old 11-01-2012, 05:43 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Don't forget that wget is just like a web browser (technically, is exactly like, except it doesn't render anything except to stdout). Whatever you could get by typing a URL into a GUI web browser, you can get with wget. As acid_kewpie mentions, wget can work recursively, meaning it can find and follow the links on a page you initially load.

--- rod.
 
Old 11-01-2012, 08:10 PM   #4
corepuncher
LQ Newbie
 
Registered: Feb 2005
Location: Norman, OK
Distribution: Fedora Core 3
Posts: 13

Original Poster
Rep: Reputation: 0
Thanks for your response.

I tried this command but it created a huge dir structure along with it. I don't want all the directories copied, just the files from the very last directory.


Quote:
Originally Posted by acid_kewpie View Post
You don't necessarily know what files are there to download, you can't literally just request a wildcard.

you can use the -r option to download recursively, try a full command like "wget -r -l1 --no-parent -A.csv domain.com/a/b/c"

alternatively, curl is useful for downloading patterns of files like [000-999].csv would cover those 1000 files explicitly.
 
Old 11-02-2012, 08:02 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
You must have either not transcribed the command correctly, or your wget does not support the --limit (-l; lower-case 'ell') option that would have limited the depth of recursion to one directory. Consult your man page for wget.

--- rod
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
simple wget questions YaMaHaBoB Linux - Software 8 06-28-2011 08:02 PM
Simple Question - needing a simple answer plz linuxnoob_sowhut Linux - Distributions 1 12-01-2010 03:54 AM
Simple question on wget Mithrilhall Linux - Software 3 01-22-2009 02:17 PM
simple wget question hcclnoodles Linux - Software 2 09-29-2004 06:25 AM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 09:03 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration