Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Optimized File Transfer Using Checksums #65

Merged
merged 1 commit into from
Oct 6, 2024

Conversation

pratikj697
Copy link
Contributor

Added the OptimizedFileTransfer class, which provides a mechanism to transfer files between directories while ensuring only modified files are transferred. The implementation relies on SHA-256 hash comparison to detect file changes, thereby optimizing file transfer and reducing redundant operations.

Features

  1. Optimized File Transfer:
    Files are transferred from a source directory to a destination directory only if the content has changed, minimizing unnecessary data transfers.
  2. SHA-256 Hashing for File Comparison:
    The system uses SHA-256 to compare the hash values of files in the source and destination directories. If the hashes differ or the file does not exist at the destination, the file is transferred.
  3. Transferred Files Tracking:
    The class maintains a list of files that were actually transferred, which can be retrieved using the get_transferred_files method.
  4. Error Handling:
    Files that are missing or unreadable are handled gracefully, with appropriate messages logged to inform the user of any issues.

Test Cases

  1. The code includes test cases simulating file transfers between directories.
  2. Files are transferred if they do not exist in the destination directory or their content has changed.
  3. The test cases also handle scenarios where files are missing or unchanged.

Example Workflow

  1. Prepare a source and destination directory.
  2. Add or modify files in the source directory.
  3. Run the transfer_files method to transfer modified files to the destination.
  4. View the list of transferred files with the get_transferred_files method.

Issue #62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants