{"id":51431449,"url":"https://github.com/andregit1/duplicate_files_counter","last_synced_at":"2026-07-05T04:02:51.713Z","repository":{"id":364508931,"uuid":"824074566","full_name":"andregit1/duplicate_files_counter","owner":"andregit1","description":"Ruby application scans a specified directory to count and identify files with the same content.","archived":false,"fork":false,"pushed_at":"2026-06-13T08:43:57.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-13T10:22:42.218Z","etag":null,"topics":["ruby","ruby3"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andregit1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-04T10:04:25.000Z","updated_at":"2026-06-13T08:44:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/andregit1/duplicate_files_counter","commit_stats":null,"previous_names":["andregit1/duplicate_files_counter"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/andregit1/duplicate_files_counter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andregit1%2Fduplicate_files_counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andregit1%2Fduplicate_files_counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andregit1%2Fduplicate_files_counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andregit1%2Fduplicate_files_counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andregit1","download_url":"https://codeload.github.com/andregit1/duplicate_files_counter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andregit1%2Fduplicate_files_counter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35142824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ruby","ruby3"],"created_at":"2026-07-05T04:02:51.030Z","updated_at":"2026-07-05T04:02:51.695Z","avatar_url":"https://github.com/andregit1.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Duplicate Files Counter\n\nThis Ruby application scans a specified directory to count and identify files with the same content. It efficiently handles large files and directories by comparing file contents using SHA-256 hashes.\n\n## How to Run the Application\n\n### 1. Clone the Repository\n\n```sh\ngit clone https://github.com/andregit1/duplicate_files_counter.git\n```\n\n### 2. Navigate to the Directory\n\n```sh\ncd duplicate_files_counter\n```\n\n### 3. Run the Script\n\nUse the command line to run the script:\n\n```sh\nruby duplicate_file_counter.rb /path/to/directory\n```\n\nReplace `/path/to/directory` with the path of the directory you want to scan.\n\n## Explanation\n\n### 1. `calculate_file_hash`\n\n- **Purpose:** Computes a SHA-256 hash of a file’s content.\n- **Function:** Reads the file in chunks to handle large files efficiently.\n\n### 2. `find_duplicate_files`\n\n- **Purpose:** Traverses the given directory recursively to find duplicate files.\n- **Function:** Uses `Find.find` to traverse the directory and calculates the hash for each file, storing the count of each hash in a hash map.\n\n### 3. `display_largest_group`\n\n- **Purpose:** Finds the file content hash with the highest count.\n- **Function:** Prints the hash and the number of files that share this hash.\n\n### 4. Dynamic Directory Input\n\n- **Purpose:** Makes the script flexible and reusable.\n- **Function:** Takes the directory path as a command-line argument, allowing it to scan any directory without changing the code.\n\n### 5. Real-time Loading Info\n\n- **Purpose:** Provides feedback on the scanning progress.\n- **Function:** Tracks and prints the progress of file scanning using `total_files` and `processed_files`.\n\n### 6. Saving Results to File\n\n- **Purpose:** Saves detailed scan results for later reference.\n- **Function:**\n  - Stores file paths for each hash in `file_hash_details`.\n  - Writes detailed results to a `.txt` file with a timestamp.\n  - Informs the user when the results are saved.\n\n## Example Output\n\nAfter running the script, a file named `duplicate_files_report_\u003ctimestamp\u003e.txt` will be created in the current directory, containing:\n\n- A list of file hashes and their counts.\n- The file paths of the duplicated files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandregit1%2Fduplicate_files_counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandregit1%2Fduplicate_files_counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandregit1%2Fduplicate_files_counter/lists"}