I'm hoping there is someone out there that knows more about FTP than I do that can help me out.
I am trying to write a script using Microsoft's FTP command line utility that will be called from the Shell in Excel (the shell will actually call a batch file that will in turn run the script). I need to be able to connect to the FTP site, check for any text files (*.txt) and download them (if any) to a specified directory on a local server (mapped network drive). I then have to delete the files from the FTP site.
I have no problem figuring out any of the above, but I need my script to be able to make sure all of the files have been copied to the local network drive before removing them from the FTP site. The records contained in these files will in turn be read into an Excel spreadsheet. If the script runs an mget *.txt command, then it deletes *.txt from the remote site there is no way of knowing for sure that all of the files on the remote got copied to the local site and vital records could be lost without anyone knowing
Is there an FTP command similar to the DOS move command that copies a file to the destination (in this case, the local network drive), then deletes it from the source once it has verified that the file exists in the destination (i.e. the FTP site), then repeats for every file?
If not, is there some way to compare the files in the destination folder to what's on the FTP site and only delete them from the FTP site if all are accounted for locally?
I should also mention that the file names will differ every time, except that they will all have a .txt extension and the number of files will also vary each time the script is executed.
Thanks in advance for any suggestions.
Alan
I am trying to write a script using Microsoft's FTP command line utility that will be called from the Shell in Excel (the shell will actually call a batch file that will in turn run the script). I need to be able to connect to the FTP site, check for any text files (*.txt) and download them (if any) to a specified directory on a local server (mapped network drive). I then have to delete the files from the FTP site.
I have no problem figuring out any of the above, but I need my script to be able to make sure all of the files have been copied to the local network drive before removing them from the FTP site. The records contained in these files will in turn be read into an Excel spreadsheet. If the script runs an mget *.txt command, then it deletes *.txt from the remote site there is no way of knowing for sure that all of the files on the remote got copied to the local site and vital records could be lost without anyone knowing
Is there an FTP command similar to the DOS move command that copies a file to the destination (in this case, the local network drive), then deletes it from the source once it has verified that the file exists in the destination (i.e. the FTP site), then repeats for every file?
If not, is there some way to compare the files in the destination folder to what's on the FTP site and only delete them from the FTP site if all are accounted for locally?
I should also mention that the file names will differ every time, except that they will all have a .txt extension and the number of files will also vary each time the script is executed.
Thanks in advance for any suggestions.
Alan