Skip to main content

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.

Metadata

Release files for foldermerge 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for foldermerge 0.4.0
File Size Uploaded
foldermerge-0.4.0.tar.gz 36.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for foldermerge 0.4.0
File Interpreter ABI Platform
foldermerge-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.4 MB

Release files / foldermerge-0.4.0.tar.gz

Download URL foldermerge-0.4.0.tar.gz
Size 36.4 MB
Tags Source
SHA-256 checksum
How to use checksums
94a6daa1eeab19f22aa4f24ef777c3d4f94fe1980ba9e823301b7b8662f9a993
BLAKE2b-256 checksum
How to use checksums
9af34fbcc9213cf199d2a0529e97d465e82e0e4429055a647ccfb403c0a8bbb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.15.1 CPython/3.10.12 Linux/6.5.0-1018-azure

Release files / foldermerge-0.4.0-py3-none-any.whl

Download URL foldermerge-0.4.0-py3-none-any.whl
Size 25.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2baac809870200f6c012affa2bcec90bf55d1539156f2662147f1f3ede8909dc
BLAKE2b-256 checksum
How to use checksums
a393ba681b4964b43403279c4620dd0bc169e9728372431ecfd3846b8e304a2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.15.1 CPython/3.10.12 Linux/6.5.0-1018-azure

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page