Return to Index

Examples

Here are some examples of how to use snatch – from basic to complex uses that you may never even care about or want to use. Please note that snatch requires perl to be installed.

Note: Most of these examples do not use real IDs.

Note for Windows users: You must run snatch from a DOS command prompt. Also, you will have to begin each command with "perl ".

Simple Download

The following command will download all the pages of a book from MOA - Michigan Books to the current directory.

snatch moamb AAA1234.0001.001

Simple Download with Verbose Reporting

Using the -v flag will cause the script to update you on the progress of the download. The following command will download all the pages of a book from MOA - Michigan Books to the current directory.

snatch -v moamb AAA1234.0001.001

Download a Different Format

Some modules allow downloading pages in different formats. To download pages in a different format, use the -f flag. Check individual module documentation for supported formats. If an unsupported format is used, the value of the -f flag is ignored and the default format used.

The following command will download all the pages of a book from Wright American Fiction as PDF files.

snatch -f pdf wright Wright2-0987

Download to a Different Directory

The -d flag can be used to download files to a directory other than the current directory. The following example will download all the pages from a book at The Hockliffe Project to a subdirectory in the current directory called "hockliffe".

snatch -d hockliffe hock 0123

Note for Windows Users: By default, perl uses Unix-style directory format (e.g., /some/directory/path/); however, if you are more comfortable using a DOS-style directory path, you can. For example, if you wanted to save your images in C:\Hockliffe, you can use the following command.

snatch -d C:\Hockliffe hock 0123

Download First 10 Pages

You can set an offset of the number of pages you want to download using the -o flag. If the value of the -o flag is greater than the total number of pages in the book being downloaded, the script will stop once all pages have been downloaded. The following command will download the first 10 pages of a book from Wright American Fiction.

snatch -o 10 wright Wright2-4321

Begin Download at Page 10

The -i flag will let you begin downloading pages at any page in the book. If the value of the -i flag is greater than the total number of the pages in the book, no pages will be downloaded. The following command will begin downloading at page 10 of a book from the University of Georgia.

snatch -i 10 uga abcd

Download Pages 11 to 20

Using the -i and -o flags in conjunction can be a handy device. For example, if you wanted to download a single article from a journal at MOA - Cornell Journals, and you know the article is on pages 11 through 20, you could use the following command.

snatch -i 11 -o 10 moacj harp0000

Literally, this command says, "Begin downloading at page 11 and continue for 10 pages." The tenth page would be page 20.

Renumber Pages Sequentially

Not every site stores their page images in a sequential format. Using the -r flag, you can have the pages automatically renumbered (and padded) to 8 characters (plus extension). The following command will download all the pages from a book hosted by Early Canadiana Online and renumber the pages.

snatch -r can 67584

Wait 5 Seconds before Downloading Each File

There are a couple of reasons you might want to wait between downloading files: to give your computer time to do other things, to open up your internet connection, or to be nice to the server you are downloading from by not bombarding them with multiple requests one right after another. The following command will cause the script to pause for 5 seconds before downloading each page image from a book at MOA - Michigan Books.

snatch -w 5 moamb ZZZ0987.0001.001

Get a List of URLs

You may not want to actually download the page images using snatch. If instead you would rather just get a list of URLs that can be passed to another program – such as wget – you can use the -u flag. The following command will generate a list of URLs for a book at the Universal Library Scanserver.

snatch -u ulscan book0

Warning: The -u flag will override the -v flag (verbose reporting).

Valid XHTML 1.0! Valid CSS! PDA Friendly