Click here to Skip to main content
15,867,871 members
Articles / Web Development / HTML
Tip/Trick

A Lightweight File Backup Manager

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
24 Jan 2015CPOL6 min read 37.9K   2.4K   22   10
A file backup manager with simple user interface and all the essential functionalities.

Introduction

An opensource Fle Backup manager with simple user interface and with all the essential functionalities for a home or regular office user. It contains two modes, first for folders and a second one for files.

Background

Well, saying about the birth of this application, for me it started as a project for personal use and then kept maintaining and enhancing for the last two years. I use this in my home desktop and laptop to sync important data to my network drive. I also use this with Google Drive to automatically backup important files and folders. Once application copies the files to my Google Drive folder, it will be uploaded into cloud. You have a laptop or desktop with SSD then configure this app since SSDs crash on you without any warnings. This will save you from losing all your loved files one day at no cost. And of course, I added some unique functionalities to this application. See it by yourself.

Using the Application

Screenshot: Homepage

Image 1

Screenshot: Add Job Window-Folder Mode

Image 2

Screenshot: Add Job Window-File Mode

Image 3

Installation

Method 1: Just copy the build folder to the location you want and run from there.

Method 2: Use the installer setup file from $\FileManagerToolSetup\FileManagerToolSetup\Express\DVD-5\DiskImages\DISK1".

Optional: Once installation is done, go to the install location and modify FileManagerLibrary.dll.config settings "UserContext" to which section you want. Refer to comments in config file for more detail.

Windows service will install during first startup of the application, which require administrator privileges to run. Separate services can be installed based on configuration specifications.

Due to service control behavior of application, it is recommended to have administrator privileges for those who manage the application.

Application Features

I will also list some of the features included in the application.

  1. Folder Mode - Select a folder to take backup of the whole folder to another location. You can exclude subfolders if you do not want to take backup.
  2. Files Mode - Select file(s) to be backed up to a common location. Schedules include monthly, weekly, daily, and also an instant one where the files are backed up as soon as they are updated.
  3. There is an option to include backup only from a certain period in past. For my case, I want to take backup of a folder but do not want to backup files that created today, since I might delete those and do not need them to be backed up.
  4. There are three operation modes. Say you can use delete mode to delete files which are older than a specific date or delete the files when it grows beyond a specific size.
  5. Cleanup Destination option in folders mode will copy the files from source but it will keep the files in backup location until the specified days. Default is 0 which will delete the files from destination if they are missing in destination. This is available only in copy mode.
  6. You can have multiple version of files in files mode.

About the Code

I haven't focused on any specific framework or patterns during design of this application. However, you will be able to find many patterns here since, while designing they snap into place automatically for those have the patterns in mind.

Also it might not be a good idea to list out each and every class and methods here since it will make a mess and do more harm than good. The project is big enough and complex to explain it fully in an article. I will explain the code in top level for your primary understanding. If you want to have a deep dive, you are welcome to download and explore. Takeout any code as you like.

File Manager modules can be grouped as below:

  1. FileBase: Group of classes which performs the file system related operations of the application.
    CopyFolders/MoveFolders/Deletefolders: Copies/deletes/moves all the folders and its contents to destination folder. This method contains handling for exceptions and wait on separate thread in case or errors like file locked for some time.
    Class Files: FileOperations.cs, FileSystemOperations.cs
  2. FileWatcher: This module is designed around FileSystemWatcher class and watches files for modifications. It is written to scale up for huge amount of files in one batch job like watch for files in C:\windows\system32\.
    Class Files: FileWatcher.cs, FileWatcherManager.cs
  3. JobManagers: There are two type of jobs in the application. Interval based make use of Threading.Timer and File change events based which make use of Filewatcher.
    Class Files: FileWatcherManager.cs, ScheduledJobManager.cs
  4. Serialization: This class takes care of saving the application data into binary files.
    Class Files: FileWatcherManager.cs, Serializer.cs
  5. UIData: These classes hold all the UI data for the application and also leaf level methods for serialization of data.
    Class Files: BackupJobData.cs, FileJobSettings.cs, FolderJobSettings.cs, LastRunStatus, UIDataBase.cs
  6. WindowsService: This section handles the Windows service related functionalities. That includes API calls for changing Windows Service mode, Start and stop a Windows service and install and uninstall Windows service.
    Class Files: ServiceStartupTypeHelper.cs, WindowsServiceHelper.cs, WindowsServiceInstallHelper.cs
  7. Config: The backup can be performed from the application in two ways, from main Dashboard and Windows Service. To make best use to code and minimize maintenance, I had to move all the business logic to a single assembly and then consume the library from both. This added technical difficulties of getting the application configuration, since I need to keep separate copies of application configurations for Windows service and desktop module. The resolution was to create a custom configuration section, which proved to be a much better approach in maintenance perspective.
    Important Class Files: AppSettings.cs, FileManagerLibraryUserSettings.cs
  8. Jobcontroller: This is the module which is responsible for operations for each job.
    Class Files: JobController.cs
  9. UI - BackupSetManager: This UI module handles the adding and editing of jobs. There are two modes of jobs and each mode is having separate controllers which inherits from a base controller.
    Class Files: BackupJobManagerControllerBase.cs, FileManagerController.cs, FolderManagerController.cs, BackupJobManagerView.cs
  10. UI - Dashboard: This is the startup and main user interface of the application.
    Class Files: DashBoard.cs

Future Expectations

  1. You might see a WCF version of this where I am planning to run the service on a remote machine. Think this might be handy in case of office environments.
  2. Planning to convert it to WPF, but require lot more time on that....so I kept it for another day...
  3. Move the binary save files to XML to enable manual editing and better portability.

History

  • 22/Jan/2015: Original version. Please leave me comments on bugs. I will fix those as I get free time, based on criticality

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
United States United States
Started Programming career with VB 6 and VC++ and now Into .Net Development. Working with .Net since its first release (Version 1.0 Beta). Lucky enough to continue always with most updated versions of .Net and as of now; May 2007, fighting with .Net 3.0 (WPF,WCF...etc) and it's next most anticipated version LINQ.

Got familiarity up on the .Net Technologies and Guidelines like CAB, and Patterns and Practices, Enterprise Library and now with it's WPF version etc.

Specialized in Windows and Distributed and Service oriented applications.

Comments and Discussions

 
QuestionAsking about the interface when launching the UI Pin
FelixWen17-Jan-19 21:15
FelixWen17-Jan-19 21:15 
QuestionNot compatible with Windows 7 Pin
Member 1254803626-May-16 4:05
Member 1254803626-May-16 4:05 
AnswerRe: Not compatible with Windows 7 Pin
shijo joseph26-May-16 14:20
shijo joseph26-May-16 14:20 
Compiled it against in 32bit.. Just give a try...


Setup.zip - Google Drive[^]
Shijo Joseph - Programming into Future.

GeneralRe: Not compatible with Windows 7 Pin
Member 125480362-Jun-16 7:42
Member 125480362-Jun-16 7:42 
GeneralRe: Not compatible with Windows 7 Pin
shijo joseph2-Jun-16 16:34
shijo joseph2-Jun-16 16:34 
GeneralRe: Not compatible with Windows 7 Pin
Member 125480364-Jun-16 14:07
Member 125480364-Jun-16 14:07 
GeneralMy vote of 5 Pin
Anurag Gandhi26-Jan-15 1:38
professionalAnurag Gandhi26-Jan-15 1:38 
QuestionDownload don't work Pin
descartes25-Jan-15 3:06
descartes25-Jan-15 3:06 
AnswerRe: Download don't work Pin
shijo joseph25-Jan-15 3:56
shijo joseph25-Jan-15 3:56 
GeneralRe: Download don't work Pin
descartes25-Jan-15 4:34
descartes25-Jan-15 4:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.