Wget from multiple paths


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Wget from multiple paths
# 1  
Old 03-11-2015
Wget from multiple paths

if I have these wildcards to download from:

Code:
path1/*.txt
path2/*.txt
path3/*.txt
path4/*.txt
path5/*.txt

under a link such as this:

Code:
http://abc .com/]abc.com

Can wget be written in such a way to extract only those files and create the corresponding paths under a target folder? So the result looks like this:

Code:
/downloads/path1/*.txt
...
/downloads/path5/*.txt

I just need to download the above in that specific pattern and folder structure.

Cheers
DH

---------- Post updated at 10:05 AM ---------- Previous update was at 10:02 AM ----------

I pasted abc.com and it interpreted the link (lol). was just an example.


hehehe

Last edited by Don Cragun; 05-05-2015 at 03:05 AM.. Reason: Add CODE and ICODE tags.
# 2  
Old 03-11-2015
Try either:

Code:
Code:
 wget -i urls.txt

And wget should generate the unique filenames for you, along with full paths if you do -x:

Code:
Code:
 wget -x -i urls.txt

urls.txt should contain the http:// and the path to the file.

Hopefully this helps Smilie.
# 3  
Old 03-11-2015
So I have to specifically list all the urls in urls.txt?

Thanks,
DH
# 4  
Old 03-12-2015
wget can recursively pull file from a webpage - provided that webpage has links to other files. This is how recursion happens.

You can't enumerate from a home page to all of its subpages if you don't have any links in the home page. Logically there is no way for wget to find what all pages in that domain (brute force search is simply not practical).

If you have links to other pages, then you can use
Code:
--accept-regex urlregex

Code:
wget

to restrict what links are recursively pulled.

In your case, if you have one web page which provides links to say "path1, path2 ..." and each pathX provides further links, you can do what you want through
Code:
wget -r

# 5  
Old 03-12-2015
Yes, specifically list the web address in the urls.txt.

An example would be: that will download the two pdf's from the site indicated and put them both in one in a folder.

HTML Code:
 http://www.genedx.com/wp-content/uploads/crm_docs/info_sheet_hedd.pdf 
http://www.genedx.com/wp-content/uploads/crm_docs/info_sheet_vws.pdf
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wget - working in browser but cannot download from wget

Hi, I need to download a zip file from my the below US govt link. https://www.sam.gov/SAMPortal/extractfiledownload?role=WW&version=SAM&filename=SAM_PUBLIC_MONTHLY_20160207.ZIP I only have wget utility installed on the server. When I use the below command, I am getting error 403... (2 Replies)
Discussion started by: Prasannag87
2 Replies

2. Shell Programming and Scripting

Wget to download multiple source code

Can a modified command be used to download multiple source codes from specific sites and output each into a separate output file?. All the sites are in a text file (attached): wget -qO- http://www.genedx.com/test-catalog/available-tests/edar-gene-sequencing/ | cat > output.txt (4 Replies)
Discussion started by: cmccabe
4 Replies

3. Shell Programming and Scripting

Download multiple files uing wget

Need Assistance . Using wget how can i download multiple files from http site. Http doesnt has wild card (*) but FTP has it . Any ideas will be appreciative. wget --timeout=120 --append-output=output.txt --no-directories --cut-dirs=1 -np -m --accept=grib2 -r http://sample.com/... (4 Replies)
Discussion started by: ajayram_arya
4 Replies

4. Shell Programming and Scripting

Storing multiple file paths in a variable

I am working on a script for Mac OS X that, among many other things, gets a list of all the installed Applications. I am pulling the list from the system_profiler command and formatting it using grep and awk. The problem is that I want to be able to use each result individually later in the script.... (3 Replies)
Discussion started by: cranfordio
3 Replies

5. Shell Programming and Scripting

Script to delete files older than x days and also taking an input for multiple paths

Hi , I am a newbie!!! I want to develop a script for deleting files older than x days from multiple paths. Now I could reach upto this piece of code which deletes files older than x days from a particular path. How do I enhance it to have an input from a .txt file or a .dat file? For eg:... (12 Replies)
Discussion started by: jhilmil
12 Replies

6. Shell Programming and Scripting

Replace directory paths in multiple files at once

I need to update about 2400 files in a directory subtree, with a new directory path inside the files I need to change this occurence in all files: /d2/R12AB/VIS/apps/tech_st/10.1.2 with this: /u01/PROD/apps/apps_st/10.1.3 I know how to change single words using "find . -type f -print0 |... (6 Replies)
Discussion started by: wicus
6 Replies

7. Shell Programming and Scripting

KSH - Find paths of multiple files in CC (dir and sub-dir))

Dear Members, I have a list of xml files like abc.xml.table prq.xml.table ... .. . in a txt file. Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file. Please help me with the script or command to do so. ... (11 Replies)
Discussion started by: Yoodit
11 Replies

8. Shell Programming and Scripting

find multiple paths

How do i find files in more than one directory? I searched through forums, but could not land into the right thread. I tried something like find dir1|dir2 -name file1 but it doesn't work. Please suggest. (5 Replies)
Discussion started by: krishmaths
5 Replies

9. Shell Programming and Scripting

Enabling a script to run in multiple paths

I have a script that i need to run from different paths. for example mypc/path1/path2/, mypc/path1/path2/path3/, and mypc/path1/path2/path3/path4 How do i set up that script so that it can execute in any of the above paths or how can i make it run on any path on my computer?? (5 Replies)
Discussion started by: dowell
5 Replies

10. Filesystems, Disks and Memory

Multiple Paths to SAN with LVM in Linux?

I'm setting up a CentOS 5 server that will be connected to an HP EVA4000. My previous experience is with an HP VA7400 and HP-UX. In HP-UX I can add "alternate paths" to a volume group in order to have redundant paths to the SAN via dual fiber channel HBAs just by either adding them with... (3 Replies)
Discussion started by: deckard
3 Replies
Login or Register to Ask a Question