Skip to content

A simple console program that zips every sub-directory in a specified directory and upload the files to a remote FTP folder. This is used as a backup purpose. It can also cleans directory older than a predefined amount of days

Notifications You must be signed in to change notification settings

danielearrighi/FTPZipAndUpload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FTPZipAndUpload

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.

Usage

Config File

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>

FtpDirectory

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.

FtpPassword

is the password for the FPT connection in encrypted format (see -p option)

Directory

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.

DeleteFilesWhenFinished

will delete all the zip files generated by the program.

CleanRemote

if > 0 (zero) it will delete all the folders older than the specified amount of days

Command Line Options

  • -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.

About

A simple console program that zips every sub-directory in a specified directory and upload the files to a remote FTP folder. This is used as a backup purpose. It can also cleans directory older than a predefined amount of days

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published