Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a huge list of ip's which point to a text file I need to download. There is about 500 text files and the text filename is the same, data.txt.

My initial thought was to use a macro to get the job done.

Public Sub Example()

Dim URL As String, LocalFilename As String

URL = "ftp://user:pass@199.99.99.9/data.txt"

LocalFilename = "C:\Power Readings\Hall A\Company Name.txt"

If URLDownloadToFile(0, URL, LocalFilename, 0, 0) = 0 Then
    'downloaded
    Stop
End If

End Sub

This works neatly. But it only does the one file. My macro above allows a download of a single file from an ftp, renames it to how I want, and places it in a directory I want. However, I need this to repeat about 100 more times for different files. How can I do this? I don't mind changing the ip,filename manually in the script, but obviously, copy and pasting the script causes errors.

My other idea, would be to have 3 columns in a spread sheet. Column A is the ip address of the file. B would be the name I wanted it to be renamed to when downloaded and C would be the directory to be downloaded to. Can this be done? So all I would need to do is populate the columns with data, hit a button and file is downloaded, renamed and placed in the right directory.

One final option would be to have a batch file, which uses windows commant prompt to download all the files for me. But I don't know any of the commands. Any ideas?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.