These are very useful command-line files if you need to do backups or synchronize files and folders between FTP servers on a regular schedule without user interaction. Some sort of "robocopy.exe /MIR" for an FTP server. (I'm using WinSCP. I have also included the current release of WinSCP 5.7.4. Why use WinSCP? Well, because I didn't want to write a full FTP client and WinSCP is an excellent tool for this.)
Upload:
The special thing about "upload.bat" is that it has a "/delete" option which will delete each file from the local source directory after it has been uploaded. It first takes a list of the files before starting the upload process. For example, some systems need to talk with each other via flat "database" files (.XML/.CSV/.TXT etc.) and this will make sure that if you add a new file in the source directory during the upload process, the new file won't be deleted while the batch is running because there is no "bulk delete". The new file will be handled on your next scheduled run. This will always upload and overwrite files on the destination without any checks.
Mirror upload:
Mirrors and uploads from a local directory to a directory on the FTP server. It will do two rounds of mirroring and compares twice. Round one with modification time and round two with file size. This is to make sure that you don't have unfinished files in the destination directory, in case of, for example a connection loss during a scheduled run.
Download:
The special thing about "download.bat" is that it has a "/delete" option which will delete each file from the remote source directory after it has been downloaded. It first takes a list of the files on the FTP directory before starting the download process. For example, some systems need to talk with each other via flat "database" files (.XML/.CSV/.TXT etc.) and this will make sure that if you add a new file in the source directory during the download process, the new file won't be deleted while the batch is running because there is no "bulk delete". The new file will be handled on your next scheduled run. This will always download and overwrite files on the destination without any checks.
Mirror download:
Mirrors and downloads from directory on the FTP server to a local directory. It will do two rounds of mirroring and compares twice. Round one with modification time and round two with file size. This is to make sure that you don't have unfinished files in the destination directory, in case of, for example a connection loss during a scheduled run.
__________________________________________________________________________________________
(As always, there is no guarantee whatsoever. Use at your own risk.)
Version 1.4: Changelog (2018-01-01):
- Contains updated WinSCP 5.11.3.
Older versions:
Version 1.3: Changelog (2015-07-11):
- The package is now called mirror<version>.zip instead of mirrorupload<version>.zip.
- Added "download.bat" and "mirrordownload.bat".
- Can now accept directories with spaces in the names.
- Automatically creates destination directory if it doesn't exist.
- Longer reconnect time from 60 to default 120 seconds.
- Compares twice, round one with modification time and round two with file size.
- Birth!