A simple console program I created for backing up my website folders in my Webserver every week (using a scheduled task). It creates a zip file for every sub-directory in a specified directory (like C:\wwwroot) and uploads the files to a remote FTP server and folder. It also cleans directories older than a predefined amount of days.
This is a very simple program written for personal use so it missings checks and maybe some extra functionality.
I just wanted to share this if someone needs it.
The program loads the config.xml file that contains a list of Queue Items. You can add as many Queue Items you like together with options and list of exclusions file/folders.
Structure of config.xml QueueItem
<QueueItem>
<FtpServer>127.0.0.1</FtpServer>
<FtpDirectory>Test/</FtpDirectory>
<FtpUser>mail@something.net</FtpUser>
<FtpPassword>ENCRYPTEDPASSWORD</FtpPassword>
<Directory>C:\wwwroot\</Directory>
<ProcessSubDirectories>true</ProcessSubDirectories>
<AppendDateTime>true</AppendDateTime>
<DeleteFilesWhenFinished>true</DeleteFilesWhenFinished>
<CleanRemote>30</CleanRemote>
<ExcludedFolders>
<string>C:\wwwroot\folder.com\bigfile.zip</string>
<string>C:\wwwroot\folder.it</string>
</ExcludedFolders>
</QueueItem>is the directory where the zipped files must be uploaded. The program will create a directory named YYYYMMDD (like 20170101) and will upload the zipped files in it. If the directory already exists (multiple uploads per day) it will create a subdirectory named HHmmss (like 090000) and will upload the zipped files in it.
is the password for the FPT connection in encrypted format (see -p option)
is the starting directory. The program will create a Zip file for every directory contained in the directory if ProcessSubDirectories is enabled; otherwise it will zip and upload the directory itself.
will delete all the zip files generated by the program.
if > 0 (zero) it will delete all the folders older than the specified amount of days
- -v for verbose output in the console. Default is true.
- -p "password" to get the encrypted version of the password to use to connect to FTP.
- -c PathToXML/config.xml to specify a different config file instead of the default one.