CompSci-61B Term Project 2
File System Backup Utility

Instructor: Prof. Robert Burns

Write a program named MyBackup.java in a package named compsci61b.project2 that synchronizes the content of separate folders: one live and the other its backup.

Synchronization between live content and its backup involves the building two separate lists, one representing live content and one for the backup, and comparing these lists. By finding, or not finding, items in the live content and in the backup, synchronization actions can be initiated, such as add, remove, and replace. What has to be identified between the lists are these categories of content: (a) files that are unchanged, (b) files that are changed, (c) files that are in the live content, but not in the backup, and (d) files that are in the backup, but not in the live content.

Write a program that compares files in a live folder (and its subfolders) and its backup, and updates the backup by:

  1. adding files that appear in the live folder but not in the backup, creating any needed subfolder structure.
  2. removing files that appear in the backup folder but not in the live, removing any empty subfolder structures.
  3. replacing files whose size is different between the live folder and its backup.

Here are the specifications:

  1. Write the program as MyBackup.java in a package named compsci61b.project2.
  2. The program reads an input file named MyBackup.txt in the working folder, with three lines: (1) the complete path to the live folder, (2) the complete path to the backup folder, and (3) a blank-delimited list of file extensions to include in the backup process.
  3. If the input file or the live folder or the backup folder are not present, the program should print usage instructions that are clear and understandable.
  4. Use either the data structure classes that you created in CompSci-61B, or use the "java.util" library data structures --it's your choice.
  5. The console output should be filenames printed to the screen. First list the files to be replaced, then the files to be added, and then the files to be removed. Print one file per line of output, with the path and filename, and the prefixxed label: ADD, REMOVE, or REPLACE. If any list is empty, append the word "none" to the heading (for example: ADD none).
  6. Do not print a list of the unaffected files -- that is, the files that are the same in the live and backup folders.
  7. After listing the files to replace, add, and remove, prompt the user if he wants to proceed with file synchronization. Do not actually perform any synchronization actions unless the user specifically elects to do so, after seeing the lists of affected files.
  8. In the coding, do NOT use searching or sorting techniques that are O(n2) or worse.

Here's what a MyBackup.txt might look like for an iTunes volume on a Windows system, backing up to a network drive:

C:\Documents and Settings\Robert Burns\My Documents\My Music\iTunes
\\192.168.1.89\music\Robert
.mp3 .m4a
Here's what a MyBackup.txt might look like for an iTunes volume on an Apple system, backing up to a network drive:
/Volumes/Macintosh HD/Users/tina/Music/iTunes/iTunes Music
/Volumes/BURNS;SERVER/Tina
.mp3 .m4a
This project is worth 100 points, awarded as follows: 20 points for the final code's neatness and presentation, including alignment and indenting of code, and comments, 80 points for the correctness of the solution. 10 points will be deducted for each listed specification that is not satisfied, with partial credit possible. Zero points will be awarded for a source file that does not compile.

Post your project2.jar file to your student UNIX account for grading and credit. The jar should contain all of the files from your lab work to date. This does not have to be complete through lab 9 -- just go as far as you need to go in order to have the data structure classes needed in the project. Do not move any lab files into the compsci61b.project2 package -- leave then in the compsci61b package!


[ Home | Contact Prof. Burns ]