A command line tool to backup and restore directories.
###Migrated from bitbucket:###
- bitbucket user: s14216618
- repo name: 251-A2-Hunt-Sam
###How to run the program###
-
Run from the command line e.g. '"Python" "mybackup.py" "Command" "Argument"' where:
- "Python" is your local installed version of Python 3.4 (I used Anaconda)
- "mybackup.py" is the absolute or relative path to my program's main module on your machine
- "Command" is one of my program's valid commands. If you get this wrong, my program will set you right though!
- "Argument" is specific to which myBackup Command you invoke. e.g. a directory or file pattern. Help is available on this.
-
Or from Pycharm with a run configuration set up from run->edit configurations,
and with "Command" "Argument"' in the script parameters text-box -
Valid commands are:
- init
- store
<directory
> - list [pattern]
- test
- get
<filename-or-pattern>
- restore [destination-directory]
- help
-
Entering an invalid command will prompt you to what the valid commands are and terminate the program
-
Entering a valid command with invalid argument will also tell you why it was invalid, then terminate the program
-
Init should be used before other commands, however ignoring this will just prompt you to do this
###Folders###
-
The program consists of 3 modules: mybackup.py, mkfilsig.py, and logger.py
-
Also there is this read-me file. There are no other files/folders.
-
The program output folder is hardcoded to '
/myArchive' where '' is the expanded current user home directory- There is only one instance of this hard-coded path at the top of the mybackup.py folder.
Feel free to change this at your leisure as all other paths which operate on the archive are relative to this - You should ensure the program has elevated privileges or sufficient permissions to write to specified directories
- There is only one instance of this hard-coded path at the top of the mybackup.py folder.
-
The program will tell you where it outputs files (current working directory etc) if you don't specify an optional one
###Interesting commits (?)###
-
b437596 test command implemented.
Re-adding inconsistent files will fix them. -
a045525 restore command implemented.
Code is relatively clean, succinct and functional.
###Notable features###
- Descriptive help function.
- Switch construct in main rather than if-else ladder.
- Re-adding inconsistent files fixes them.
- Invalid commands reroutes to help.
- Most exceptions are handled further up the call-stack in main instead.
###Future Improvements###
The ARCHIVE_PATH should be variable rather than hard-coded. This could be handled as an additional command-line parameter.
Python's gzip library implementation 'gz' could be used to save space by compressing backed up files.