FTP Help, anyone? (Move files via FTP)

acollins

Board Regular
Joined
Aug 1, 2007
Messages
63
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
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,215,219
Messages
6,123,685
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top