Skip to main content

Default template for PDM package

Project description

pdm-managed

File Hashing and Directory Comparison Tool

This project provides a Python utility for hashing files within directories, comparing directory contents, and assisting with folder merging. It is designed to be used on local filesystems where you need to compare folders, identify duplicates, and potentially merge them.

Features

  • Hash Generation: Create SHA1 hashes for files to efficiently compare content.
  • Directory Comparison: Compare files across directories by name and content.
  • Merging Assistance: Identify identical, moved, and modified files to help with directory merging.
  • Status Tracking: Store and track the status of operations in a JSON file.

Usage

To use this tool, simply instantiate the FolderMerger class with the destination repository and the source repositories you want to compare and potentially merge. The class will automatically scan the directories, generate hashes, and prepare comparisons.

Here is a basic example of how to use the tool:

from pathlib import Path
from file_hashing_tool import FolderMerger


# Define the destination directory and the list of source directories

destination_dir = Path("path/to/destination")
source_dirs = [Path("path/to/source1"), Path("path/to/source2")]


# Create a FolderMerger instance

merger = FolderMerger(destination_dir, source_dirs)


# Perform comparison and generate report

comparison_report = merger.report()


# Print the report to view the comparison results

for report in comparison_report:
    print(report)

Requirements

  • python 3.7+
  • pandas
  • tqdm

Components

  • HashLibrary: Class responsible for generating and storing file hashes.
  • FolderChecker: Class for scanning directories and storing file information.
  • FolderComparator: Class for comparing two folders and identifying differences.
  • Folders: Utility class to organize and access multiple FolderChecker instances.
  • FolderMerger: Main class to orchestrate directory comparison and merging.

Clearing Results

To clear any saved results and statuses, you can call the clear_results function which will remove all saved .pickle and status.json files from the default results path (typically ~/Downloads/FILE_HASHES).

Development

The project is modular, allowing for easy extension and customization. New comparison strategies or different hashing algorithms can be added by extending the relevant classes.

License

This project is open-source and available under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

foldermerge-0.1.0.tar.gz (36.4 MB view details)

Uploaded Source

Built Distribution

foldermerge-0.1.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file foldermerge-0.1.0.tar.gz.

File metadata

  • Download URL: foldermerge-0.1.0.tar.gz
  • Upload date:
  • Size: 36.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.12.4 CPython/3.10.12

File hashes

Hashes for foldermerge-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d21aa4bb3993d700250b6e79a33ab677dde0b34cd0d58a54d331a83791015107
MD5 babd65538ab2b47be13030967a38a208
BLAKE2b-256 fee41f4bfa3dee880ab522bfe946a256c6c0f8f33f7717400cc95dfb2c8533a3

See more details on using hashes here.

File details

Details for the file foldermerge-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: foldermerge-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.12.4 CPython/3.10.12

File hashes

Hashes for foldermerge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbef78e028be249f52183a391e004c887a1840463a8a69fb5158af9d8407a206
MD5 4376582da1b128b711f23d993bd849e4
BLAKE2b-256 f6d0252735ef7d3cfc43c1411be17069361e8d8e4a307d1b9a8fdfa3aeaf6e91

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page