{"id":44584993,"url":"https://github.com/khangvum/fileusage","last_synced_at":"2026-02-14T06:01:54.179Z","repository":{"id":281431358,"uuid":"931307377","full_name":"khangvum/fileusage","owner":"khangvum","description":"A Windows console application that lists file usage by grouping files based on their extensions.","archived":false,"fork":false,"pushed_at":"2025-08-21T02:01:34.000Z","size":32,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-21T04:30:31.746Z","etag":null,"topics":["cpp","cpp17","cpp20","file-extension","file-extensions","file-management","file-manager","file-scan","file-scanner","file-scanning","file-size","file-sizes","file-usage","filesystem","fileusage"],"latest_commit_sha":null,"homepage":"","language":"C++","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/khangvum.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":"2025-02-12T03:53:10.000Z","updated_at":"2025-08-21T02:01:38.000Z","dependencies_parsed_at":"2025-03-09T03:23:29.113Z","dependency_job_id":"84a39e92-255b-40be-a626-896a6bd456d6","html_url":"https://github.com/khangvum/fileusage","commit_stats":null,"previous_names":["khangvum/fileusage"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/khangvum/fileusage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khangvum%2Ffileusage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khangvum%2Ffileusage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khangvum%2Ffileusage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khangvum%2Ffileusage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khangvum","download_url":"https://codeload.github.com/khangvum/fileusage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khangvum%2Ffileusage/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29438641,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T05:24:35.651Z","status":"ssl_error","status_checked_at":"2026-02-14T05:24:34.830Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cpp","cpp17","cpp20","file-extension","file-extensions","file-management","file-manager","file-scan","file-scanner","file-scanning","file-size","file-sizes","file-usage","filesystem","fileusage"],"created_at":"2026-02-14T06:01:22.055Z","updated_at":"2026-02-14T06:01:54.174Z","avatar_url":"https://github.com/khangvum.png","language":"C++","readme":"# File Usage\n\nA Windows console application that lists **_file usage_** by grouping files based on **_their extensions_**. This program counts the **_total_** number of files and calculates their cumulative **_sizes_**.\n\n## Features\n\n-   Lists **_files in a directory_** and **_groups them by their file extensions_**.\n-   Displays the **_total number of files per extension_**.\n-   Calculates the cumulative **_size of files for each extension_**.\n-   Simple, fast, and lightweight **_console-based_** interface.\n\n## Modern File Management with `\u003cfilesystem\u003e`\n\nFor **_efficient_** and **_modern file management_**, the program utilizes the `\u003cfilesystem\u003e` library, introduced in **_C++17_**. Compared to legacy and platform-specific methods (_e.g._ `FindFirstFile`, `FindNextFile` on Windows), which were often bulky and mistake-susceptible, this library introduces a **_standardized_**, **_cross-platform_**, and **_intuitive_** approach for handling files and directories.\n\n-   **Cross-Platform Compatibility:** The `filesystem` library works seamlessly across **_Windows_**, **_Linux_**, and **_macOS_**, eliminating the need for platform-specific code.\n-   **Ease of Use:** This library streamlines **_straightforward_** and **_high-level_** APIs for common operations like iterating directories, retrieving file sizes, and filtering files based on extensions.\n\n    ```cpp\n    for (const auto\u0026 entry : std::filesystem::directory_iterator(dir_path)) {\n        if (entry.is_regular_file()) {\n            auto size{ entry.file_size() };\n        }\n    }\n    ```\n\n-   **Performance:** Optimized for **_modern hardware_**, `filesystem` offers better performance compared to legacy implementations.\n-   **Built-in Error Handling:** This modern approach automatically throws exceptions for **_invalid paths_**, **_permission issues_**, etc. simplifying error management.\n\n## Performance Optimization with Thread Pooling\n\nTo improve the program's performance, a custom `ThreadPool` is used for **_concurrent execution_**. By utilizing **_multiple threads_**, the program can efficiently **_process files in parallel_**, significantly reducing execution time, especially when dealing with large directories containing numerous files (_e.g._ `C:\\`).\n\n-   **Parallel Task Execution:** The `ThreadPool` manages **_a pool of worker threads_** that handle tasks concurrently, ensuring **_faster file scanning_**.\n-   **Efficient Resource Utilization:** The number of threads is determined based on the **_hardware's logical processors_**, maximizing CPU utilization without overwhelming the system.\n\n    ```cpp\n    size_t num_threads{ thread::hardware_concurrency() };\n    ```\n\n## Usage\n  \n\u003c!-- \u003cpre style=\"font-family: Consolas, monospace; font-size: 14px; background-color: #eee; padding: 15px; border: 1px solid #ccc; border-radius: 5px; white-space: pre; color: #333;\"\u003e --\u003e\n\n```\nUsage: fileusage [--help] [-hdrsv(x regularexpression)] [folder]\nswitches:\n        h       help\n        d       reverse the order of listing\n        r       suppress recursion\n        s       sort by file sizes\n        v       verbose\n        b       benchmark\n        x       filter with a regular expression\n\nfolder\n        starting folder or current folder if not specified\n```\n\n\u003c!-- \u003c/pre\u003e --\u003e\n\n## Ignored Files\n\nThe following files are **_intentionally excluded_** from the repository:\n\n-   scan_directory.cpp\n-   ThreadPool.hpp/ThreadPool.cpp\n-   benchmark.cpp\n\nThese files are excluded for **_personal_** and **_copyright_** reasons. If you need these files, please contact me via my email: [manhkhang0305@gmail.com](mailto:manhkhang0305@gmail.com)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhangvum%2Ffileusage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhangvum%2Ffileusage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhangvum%2Ffileusage/lists"}