Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip: Skip download if already done #521

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
* [Rate limiting](usingcurl/transfers/rate-limiting.md)
* [Request rate limiting](usingcurl/transfers/request-rate.md)
* [Compression](usingcurl/transfers/compression.md)
* [Skip download if already done](usingcurl/transfers/skip.md)
* [Connections](usingcurl/connections/README.md)
* [VLAN](usingcurl/connections/vlan.md)
* [Name resolve tricks](usingcurl/connections/name.md)
Expand Down
1 change: 1 addition & 0 deletions usingcurl/transfers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ multiple transfers.
* [Rate limiting](rate-limiting.md)
* [Request rate limiting](request-rate.md)
* [Compression](compression.md)
* [Skip download if already done](skip.md)
24 changes: 24 additions & 0 deletions usingcurl/transfers/skip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Skip download if already done

Sometimes when writing a script or similar to do Internet transfers every now
and then you end up in a situation when you rather have curl skip doing the
transfer if indeed the target file is already present locally. Maybe after the
previous invoke, maybe for another reason.

This kind of extra logic can certainly be added in common shell script logic
before curl is invoked in many cases but not all. For example things get
complicated when you ask curl to use [globbing download
ranges](../../cmdline/urls/globbing.md).

For example, download one thousand images from a site but skip the ones that
we already have downloaded previously:

curl --skip-existing -O https://example.com/image[0-999].jpg

It should be noted that this only checks the *presence* of the local file, it
makes not attempts to verify that it actually has the correct content and it
has no way to do any such checks.

curl offers other options to do [conditional
transfers](../../http/modify/conditionals.md) based on modified date or
contents.
Loading