Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am running wget on a site that (I have come to realize) has two languages - and duplicate pages for each language. I've already got the content in English, so I'd like to stop wget from downloading anything more. I specified the -k switch when I ran it, so will it convert the links to relative links as usual if I stop wget before it's done completely downloading everything? Or will it simply stop?

(There's another question on the StackExchange network that addresses forcing wget to convert links on already downloaded content by running

wget -nc -k [previous options] [previous url]

but timestamps were accidentally turned off so that's not an option.)

share|improve this question

1 Answer 1

up vote 4 down vote accepted

No.

The -k option is not applied until the download has completed.

If wget is cancelled (ie, ctrl+c) then the -k option will not be invoked.

You can see this when wget completes, the last steps is the conversion of the links.

It tells you at the end, how many .html files it converted. Their timestamps also get updated during this process.

UPDATE: Try making use of the -R option to exlude the files that are in a different language. But this only works if the files have something that makes them uniformly unique.

Try for example:

-R*_en*.htm*

That would exclude files that end in .htm or .html and that have the _en somewhere in their path. I use an underscore or something that would buffer the "en" portion because I do not want to exclude files that simply contain an "en".

But this only works if their is consistency in the file naming.

share|improve this answer
    
Aargh. Thanks for the quick answer (though it's not the one I wanted...). –  kathryn Jun 27 '12 at 17:07
    
@kathryn lol. Like a genie, you get what you ask for. I've updated the answer to show how the -R (--reject) option could work. –  SaultDon Jun 27 '12 at 17:16
    
Thanks for the suggestion; much appreciated (even if only for the future, heh). The thing is that wget is downloading right now - you can't modify the job as it's running, can you? –  kathryn Jun 27 '12 at 18:14
    
No, unfortunately you can't, but, if you want to cancel, go ahead, and when you rerun wget also add the -nc (no clobber) option. This will prevent files you've already downloaded from being downloaded again. –  SaultDon Jun 27 '12 at 18:30

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.