Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a list of files that I need to download such as

www.domain.com/files/archive.zip
www.domain.com/img/icon.ico
www.domain.com/files/backup/archive.zip
www.domain.com/backup/img/icon.ico
www.domain.com/archive.zip

meaning that i got name collision in this list of files so i need to keep the directory structure intact and recreate it while downloading this, i haven't found nothing even similar to this in the Python urllib and I don't know of any linux tool that can be good for this.

Any suggestion ?

share|improve this question
    
Where exactly do you see the problem doing this with bash? - I mean: mkdir files; cd files; wget www.domain.com/files/archive.zip; mkdir ../img/; cd ../img/ wget .... –  Simon Strasser Jan 2 '13 at 11:01
    
@SimonStrasser at first i was trying with python, with the bash i just don't know a name for a good tool ... –  user1797612 Jan 2 '13 at 11:02

2 Answers 2

up vote 1 down vote accepted

You're looking for wget - it will by default recreate the same directory structure on your localhost as on the webserver it's fetching stuff from.

share|improve this answer
    
thanks, wget is able to read from a text file the list of files to download ? –  user1797612 Jan 2 '13 at 11:02
    
Yes. It's quite versatile. There's info at gnu.org/software/wget –  Jenny D Jan 2 '13 at 11:05
    
wget -x -i file.txt does the trick, thanks :D –  user1797612 Jan 2 '13 at 11:16

wget can do this pretty easily:

wget -x -nH http://www.domain.com/files/archive.zip

This will create the local directory files and download archive.zip into it.

share|improve this answer
    
ok, thanks, but i was handling this starting from a text file serverfault.com/questions/462260/… –  user1797612 Jan 2 '13 at 11:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.