{"id":20858648,"url":"https://github.com/giacomelli/backupsharp","last_synced_at":"2026-04-26T14:31:23.108Z","repository":{"id":22501771,"uuid":"25841354","full_name":"giacomelli/BackupSharp","owner":"giacomelli","description":" A C# library and a command-line to backup your items from any source to any destination.","archived":false,"fork":false,"pushed_at":"2017-05-06T12:43:03.000Z","size":590,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-19T07:24:10.978Z","etag":null,"topics":["backup","c-sharp","dropbox","ftp-server","mysql","zip"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giacomelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-27T22:04:38.000Z","updated_at":"2017-05-06T12:43:05.000Z","dependencies_parsed_at":"2022-08-20T17:40:10.191Z","dependency_job_id":null,"html_url":"https://github.com/giacomelli/BackupSharp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomelli%2FBackupSharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomelli%2FBackupSharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomelli%2FBackupSharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giacomelli%2FBackupSharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giacomelli","download_url":"https://codeload.github.com/giacomelli/BackupSharp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243230101,"owners_count":20257644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backup","c-sharp","dropbox","ftp-server","mysql","zip"],"created_at":"2024-11-18T04:46:47.274Z","updated_at":"2025-12-25T14:36:21.449Z","avatar_url":"https://github.com/giacomelli.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BackupSharp\r\n\r\nA C# library and command-line to backup your items from any source to any destination.\r\n\r\n## Sources \u0026 Destinations\r\nBelow are the current available sources and destinations:\r\n\r\n* Sources\r\n\t* FTP\r\n\t* Local folder\r\n\t* MySQL\r\n* Destinations\r\n\t* Dropbox \t\r\n\t* Local Folder\r\n\t* Zip\r\n\t\t\r\n## Using the command-line\t\r\n### Command-line options\r\n```bash\r\nmono BackupSharp.CommandLine.exe --help\r\n```\r\n\r\n* -s, --sourceName\r\n\t\t  \t\t\r\n\t\tThe backup source class name\r\n\r\n* -r, --sourceArgs         \r\n\r\n\t\tThe backup source class constructor args\r\n\r\n* -d, --destinationName    \r\n\r\n\t\tThe backup destination class name\r\n\r\n* -t, --destinationArgs\r\n\r\n\t\tThe backup destination class constructor args\r\n\r\n* -f, --file               \r\n\r\n\t\tRequired. The backup configuration file\r\n\r\n* -b, --backupName       \r\n\r\n\t\tOnly backup with specified name will be run\r\n\r\n* --sourceStartsWith       \r\n\r\n\t\tOnly backup with source ID that starts with specified text\r\n\r\n* --sourceEndsWith        \r\n\t\r\n\t\tOnly backup with source ID that ends with specified text\r\n\r\n* -v, --verbose            \r\n\r\n\t\tShould log everything\r\n\r\n### Source arguments\r\n\r\n#### FTP\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=FTP \r\n--sourceArgs=[server address],[username],[password] \r\n--destinationName=[destination] \r\n--destinationArgs=[destination args]\r\n```\r\nWhere:\r\n* [server address] = The address/IP of the source FTP server.\r\n* [username] = The username used to connect on FTP server.\r\n* [password] = The password used to connect on FTP server.\r\n\r\n#### Local folder\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=LocalFolder \r\n--sourceArgs=[source id],[source folder] \r\n--destinationName=[destination] \r\n--destinationArgs=[destination args]\r\n```\r\nWhere:\r\n* [source id] = The ID used to identify source.\r\n* [source folder] = The path to the source folder.\r\n\r\n#### MySQL\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=MySql \r\n--sourceArgs=[connection string] \r\n--destinationName=[destination] \r\n--destinationArgs=[destination args]\r\n```\r\nWhere:\r\n* [connection string] = The connection string to MySQL database.\r\n\r\n### Destination arguments\r\n\r\n#### Dropbox\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=[source] \r\n--sourceArgs=[source args] \r\n--destinationName=Dropbox \r\n--destinationArgs=[API key],[API secret],[access token]\r\n```\r\nWhere:\r\n* [API key] = App key from Dropbox developer App Console.\r\n* [API secret] = App secrect from Dropbox developer App Console.\r\n* [access token] = Access token from Dropbox developer App Console.\r\n\r\n\r\n\u003e To use the Dropbox destination you will need to create an app on Dropbox developer App Console (https://www.dropbox.com/developers/apps), then access the app details where you can get the API key, API secret and the access token ('Generate acces token`).\r\n\r\n####Local folder\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=[source] \r\n--sourceArgs=[source args] \r\n--destinationName=LocalFolder \r\n--destinationArgs=[destination folder]\r\n```\r\nWhere:\r\n* [destination folder] = The destination folder path.\r\n\r\n#### Zip\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=[source] \r\n--sourceArgs=[source args] \r\n--destinationName=Zip \r\n--destinationArgs=[destination folder]\r\n```\r\nWhere:\r\n* [destination folder] = The destination folder where the Zip file will be generated.\r\n\r\n### Samples  \r\n\r\n#### Ftp2Dropbox\r\nBackup items from a FTP server to a Dropbox account:\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=FTP \r\n--sourceArgs=[server address],[username],[password] \r\n--destinationName=Dropbox \r\n--destinationArgs=[API key],[API secret],[access token]\r\n```\r\n\r\n#### Ftp2LocalFolder\r\nBackup items from a FTP server to a local folder:\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=FTP \r\n--sourceArgs=[server address],[username],[password] \r\n--destinationName=LocalFolder \r\n--destinationArgs=[destination folder]\r\n```\r\n\r\n#### Ftp2Zip\r\nBackup items from a FTP server to a Zip file:\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=FTP \r\n--sourceArgs=[server address],[username],[password] \r\n--destinationName=Zip \r\n--destinationArgs=[destination folder]\r\n```\r\n\r\n#### LocalFolder2Zip\r\nBackup items from a local folder to a Zip file:\r\n```\r\nmono BackupSharp.CommandLine.exe \r\n--sourceName=LocalFolder \r\n--sourceArgs=[source id],[source folder] \r\n--destinationName=Zip \r\n--destinationArgs=[destination folder]\r\n```\r\n\r\n### Using a .config file\r\n```xml\r\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\r\n\u003cbackupSharp\u003e\r\n\t\u003csources\u003e\r\n\t\t\u003csource type=\"LocalFolder\" id=\"SourceFolder\" args=\"temp/source\" /\u003e\t\t\r\n        \u003csource type=\"MySql\" id=\"SourceMySql\" args=\"server=my_server_address;user=my_user;pwd=my_password;database=my_database_name;allowzerodatetime=true;\" /\u003e\r\n\t\u003c/sources\u003e\r\n\t\r\n\t\u003cdestinations\u003e\r\n\t\t\u003cdestination type=\"Zip\" id=\"DestinationZip\" args=\"temp\" /\u003e\r\n\t\u003c/destinations\u003e\r\n\t\r\n\t\u003cbackups\u003e\r\n\t\t\u003cbackup source=\"SourceFolder\" destination=\"DestinationZip\" /\u003e\r\n\t\t\u003cbackup source=\"SourceMySql\" destination=\"DestinationZip\" /\u003e\r\n\t\u003c/backups\u003e\r\n\u003c/backupSharp\u003e\r\n```\r\n```bash\r\nmono BackupSharp.CommandLine.exe -f my_backups.config\r\n```\r\n\r\n## Using the library\r\n### Running a backup from MySQL to Zip\r\n```csharp\r\nvar source = new MySqlBackupSource(connectionString);\r\nvar destination = new ZipBackupDestination(destinationFolderPath);\r\nvar backup = new Backup(source, destination);\r\nbackup.Run();\r\n```\r\n\r\n### Creating a new backup source\r\nTo implement a new backup source you can implement the IBackupSource interface or inherit from BackupSourceBase:\r\n\r\n```csharp\r\npublic class SampleBackupSource : BackupSourceBase\r\n{\r\n\t\t/// \u003csummary\u003e\r\n        /// Gets the items.\r\n        /// \u003c/summary\u003e\r\n        /// \u003creturns\u003e\r\n        /// The available items on source.\r\n        /// \u003c/returns\u003e\r\n        public override IEnumerable\u003cIBackupItem\u003e GetItems()\t\r\n\t    {\r\n\t\t\t// Get the available items on backup source.\r\n\t\t\t// Remember to use yield ;)\r\n\t    }\r\n\r\n        /// \u003csummary\u003e\r\n        /// Reads the item.\r\n        /// \u003c/summary\u003e\r\n        /// \u003cparam name=\"item\"\u003eThe item.\u003c/param\u003e\r\n        /// \u003creturns\u003e\r\n        /// The item byte array.\r\n        /// \u003c/returns\u003e\r\n        public override byte[] ReadItem(IBackupItem item)\r\n\t\t{\r\n\t\t\t// Reads the backup item in an array of bytes.\r\n\t\t}\r\n}\r\n```\r\n\r\n### Creating a new backup destination\r\nTo implement a new backup destination you can implement the IBackupDestination interface or inherit from BackupDestinationBase:\r\n\r\n```csharp\r\npublic class SampleBackupDestination : BackupDestinationBase\r\n{\r\n\t\t/// \u003csummary\u003e\r\n        /// Stores the item.\r\n        /// \u003c/summary\u003e\r\n        /// \u003cparam name=\"item\"\u003eThe item.\u003c/param\u003e\r\n        /// \u003cparam name=\"data\"\u003eThe data.\u003c/param\u003e\r\n        public override void StoreItem(IBackupItem item, byte[] data)\r\n\t\t{\r\n\t\t\t// Writes the item using information on item.DestinationFullName and the bytes from data argument.\r\n\t\t}\r\n}\r\n```\r\n\r\n## Running the functional tests\r\nTo run the tests from BackupSharp.FunctionalTests project you will need to set some environment variables:\r\n\r\n- FTP\r\n\t- BackupSharpFtpServer\r\n\t- BackupSharpFtpUserName\r\n\t- BackupSharpFtpPassword\r\n\t- BackupSharpFtpFolder\r\n- MySQL\r\n\t- BackupSharpMySqlServer\r\n\t- BackupSharpMySqlUserName\r\n\t- BackupSharpMySqlPassword\r\n\t- BackupSharpMySqlDatabase\r\n- Dropbox\r\n\t- BackupSharpDropboxApiKey\r\n\t- BackupSharpDropboxApiSecret\r\n\t- BackupSharpDropboxAccessToken\r\n\r\n\u003e We use environment variables to define those arguments to functional/integration tests because with environment variables we can encrypt the data to Travis-CI, like described in this tutorial [\"Using sensitive data on your Travis-CI build\"](http://diegogiacomelli.com.br/2014/07/04/using-sensitive-data-on-your-travis-ci-build).\r\n\r\n## FAQ\r\n\r\n#### Having troubles? \r\n - Ask on [Stack Overflow](http://stackoverflow.com/search?q=BackupSharp)\r\n\r\n## Roadmap\r\n* Package command-line to GitHub releases section.\r\n* Publish NuGet package.\r\n* New sources\r\n\t* MS SQL Server \r\n \r\n--------\r\n\r\n## How to improve it?\r\n- Create a fork of [BackupSharp](https://github.com/giacomelli/BackupSharp/fork). \r\n- Did you change it? [Submit a pull request](https://github.com/giacomelli/BackupSharp/pull/new/master).\r\n\r\n\r\n## License\r\n\r\nLicensed under the The MIT License (MIT).\r\nIn others words, you can use this library for developement any kind of software: open source, commercial, proprietary and alien.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiacomelli%2Fbackupsharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiacomelli%2Fbackupsharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiacomelli%2Fbackupsharp/lists"}