Hello everyone,
I need to download thousands of files from the Security and Exchange Commission’s website. Access is through anonymous FTP with “anonymous” as the username and my email address as the password. I’ve been using urlSave in a loop but my script aborts with session-timed-out or cannot-connect-to-server types of errors after a few dozen, and sometimes a few hundred downloads. The SEC’s webmaster tells me that “There is no load/rate limiting on FTP, but if you are running a fast process, it is possible you are temporarily overwhelming the server.” So, I’m thinking that I need to throttle my requests, and maybe should be using URLSaveAsynchronous to check the status of the current file being downloaded and not request another file until the current download is complete. I also wonder whether I should be connecting to the FTP site only once with the username and password, loop my requests, and then close the connection. Again, I don’t know how to do this in Mathematica.
Any tips or suggestions would be much appreciated.
Hi Sean,
Thank you for responding. Not sure how to check whether a download succeeds. I could rig something with FileExistsQ, but I suspect there is a slicker way by checking the status of an url function such as URLSaveAsynchronous with its Progress option.