Get files from SVN via wget

If one has to manually download all the stuff from a given SVN-branch, this could be a very tedious task right-clicking every thing and saving it to local disk. Luckily this could be automated via wget, which comes with most Linux distributions (there are Windows-ports out there too).

If for example I want to download all the stuff from http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SemanticForms/ I “wget” it this way:

wget -e robots=off --wait 1 -r -I /svnroot/mediawiki/trunk/extensions/SemanticForms/ http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SemanticForms/

“-e robots=off” ignores the robots.txt
“–wait 1″ waits 1 second between the downloads
“-r” scans the server recursively
“-I /svnroot/mediawiki/trunk/extensions/SemanticForms/” includes the given path and below (excluding all the rest)

The latter one (“-I …”) is important! If omitted, wget would scan the whole server up and down – not limited to the “SemanticForms”-subdir.

Edit 2012-05-22:
There is an easier way of limiting the wget-operation to the given branch: the “-np” option. This switch keeps wget from ascending to the parent directory. So you could omit the -I mentioned above and use -np instead to get the same result with less typing. (Thank you Joe for the advice!)

About these ads

4 Responses to Get files from SVN via wget

  1. steff says:

    You should also add “-l 0″ (that’s lowercase L) to make wget traverse the whole depth of the branch. I think the default max depth is 5.

  2. Travis Cummins says:

    Thanks! This is exactly what I needed.

  3. Joe says:

    I had to add “-X http:///” and incidentally, I used “-np” instead of the “-I …” option.

    • logbuffer says:

      Thanks for the “-np” hint, Joe!
      This would have done my job a little easier.
      Apparently I didn’t read the “wget –help” till the last line:

       -np, --no-parent                 don't ascend to the parent directory.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: