/Directory-Snapshot

:file_folder: :floppy_disk: A tool to create a snapshot ( poor man's backup ) of a directory.

Primary LanguagePythonMIT LicenseMIT

Directory Snapshot

MIT License Blazing fast Say thanks

  • A recursive directory listing program that produces a set of interlinked HTML files, structured in the same form as the input directory.
  • Rather than taking a backup of the contents of a directory; instead it just stores the metadata (name, size etc.) of all the contents in a directory.
  • It can be useful when you do not have enough space for a full backup, and your data consists of files which could be obtained easily again from another source after a disk failure (for example, software installation files).
    It can be thought of as a hyperlinked version of the dir /s or tree /f commands.

Installation

  • Requires Python 3.7+.
  • pip install tqdm (Required only if you want progress bar functionality).

Usage

main.py [-h] [-dry] [-no-bar] [-no-hid] [-no-sym] [-max-rec MAX_RECURSION_DEPTH] src-path dest-path

positional arguments:
  src-path              The path of the source directory.
  dest-path             The path of the destination directory.

optional arguments:
  -h, --help            Show this help message and exit
  -dry, --dry-run       Just estimate the size of source directory and exit.
  -no-bar, --hide-progress-bar
                        Whether to hide the progress bar or not (default
                        dont hide); will be silently ignored if "tqdm" package not
                        found.
  -no-hid, --ignore-hidden
                        Whether to ignore hidden files and directories or not
                        (default not ignored).
  -no-sym, --ignore-symlinks
                        Whether to ignore symlinks or not (default not ignored).
  -max-rec MAX_RECURSION_DEPTH, --max-recursion-depth MAX_RECURSION_DEPTH
                        Maximum recursion depth (default infinite).
  • Example:
    python3 main.py /Users/ajaggi/projects /Users/ajaggi/Desktop/snapshots --ignore-symlinks -no-hid -max-rec=5

To-Do

  • Debug progress bar populating way too soon for projects dir.
  • Add demo.
  • Publish to pypi.
  • Add test cases (especially edge cases like permission errors etc).
  • Add code coverage.
  • Setup tox and Travis CI.
  • Add benchmarks.
  • Add GUI.
  • Explore parallel processing (Will have to use BFS instead of DFS probably).
  • Implement dry-run option.
  • Implement no-hid option.
  • Implement no-sym option.
  • Implement max-rec option.
  • Use logging module instead of print statements.
  • Log full exception stacktrace rather than just the message.