I am on the lookout for a function in R to check if an HTML file was incompletely downloaded, i.e. to read just the last few lines of a given set of files and check if they end with "</html>"
. What would be the best way to check for this? Related question is how to avoid if one uses download.file
that an incompletely downloaded file would be left after interrupting a script?
Asked
Active
Viewed 36 times
0

Tom Wenseleers
- 7,535
- 7
- 63
- 103
-
So, you're presuming that the file is well-formed? If your criteria for "completely downloaded" would mean having ` – A5C1D2H2I1M1N2O1R2T1 Jul 16 '14 at 15:37
-
Well I would like the criterion to be to have this at the last 3 lines of the file, and so the question would reduce to how to efficiently read in only the last 3 lines of each file. Any thoughts? – Tom Wenseleers Jul 16 '14 at 16:20
-
What OS? The `tail` function in Linux would be very useful here, I would guess. `tail -3 yourfile.txt` – A5C1D2H2I1M1N2O1R2T1 Jul 16 '14 at 16:41
-
Ha it would have to be cross platform ideally, that's why I would prefer not to resort to bash linux tools... – Tom Wenseleers Jul 16 '14 at 21:04