{"id":20095320,"url":"https://github.com/rlalpha49/line-counter","last_synced_at":"2026-06-05T06:31:37.129Z","repository":{"id":222575476,"uuid":"757788822","full_name":"RLAlpha49/Line-Counter","owner":"RLAlpha49","description":"Line Counter: A Python script to count the number of lines in all files within a specified directory, with options to include or exclude certain files and extensions.","archived":false,"fork":false,"pushed_at":"2024-05-15T08:35:16.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T16:24:12.765Z","etag":null,"topics":["line-counter","python","python-script","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RLAlpha49.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-02-15T01:22:40.000Z","updated_at":"2024-05-15T08:35:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c296eb6-23e6-478e-82dc-7b6c6b8f5c9d","html_url":"https://github.com/RLAlpha49/Line-Counter","commit_stats":null,"previous_names":["rlalpha49/code-lines"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RLAlpha49/Line-Counter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RLAlpha49%2FLine-Counter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RLAlpha49%2FLine-Counter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RLAlpha49%2FLine-Counter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RLAlpha49%2FLine-Counter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RLAlpha49","download_url":"https://codeload.github.com/RLAlpha49/Line-Counter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RLAlpha49%2FLine-Counter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33932048,"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-06-05T02:00:06.157Z","response_time":120,"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":["line-counter","python","python-script","python3"],"created_at":"2024-11-13T16:54:51.039Z","updated_at":"2026-06-05T06:31:37.104Z","avatar_url":"https://github.com/RLAlpha49.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Line Counter\n\nThis Python script counts the number of lines in all files within a specified directory, excluding or including\nspecified files and extensions.\n\n## Installation\n\nTo install the script, you can clone the repository and run the script directly:\n\n```bash\ngit clone https://github.com/yourusername/line-counter.git\ncd line-counter\npython main.py\n```\n\n## Making the Script Executable\n\nThe script can always be run by calling `python /path/to/main.py`, but you can make it executable so that you can run it\nby typing `line-counter` or `line-counter.bat` into the terminal. Here's how you can do it:\n\n### Unix-like Systems (Linux, macOS)\n\n1. Make the script executable. You can do this by changing the permissions of the script file. Open a terminal, navigate\n   to the directory containing the script, and run the following command:\n\n    ```bash\n    chmod +x main.py\n    ```\n\n2. Rename the script to line-counter (without the .py extension). You can do this with the following command:\n\n    ```bash\n    mv main.py line-counter\n    ```\n\n3. Move the script to a directory that's on the system's PATH. The PATH is a list of directories that the system\n   searches through when looking for executables. You can move the script to /usr/local/bin, which is a common place to\n   put custom scripts:\n\n    ```bash\n    sudo mv line-counter /usr/local/bin\n    ```\n\nNow, you should be able to run the script from anywhere by typing line-counter into the terminal.\n\n### Windows\n\n1. Add the directory containing the line-counter batch file to your system's PATH. Here's how you can do it:\n    - Right-click on 'Computer' and click on 'Properties'.\n    - Click on 'Advanced system settings'.\n    - Click on 'Environment Variables'.\n    - Under 'System Variables', find the 'Path' variable, select it, and click on 'Edit'.\n    - In the 'Variable value' field, append the full path to the directory containing the batch file.\n\nNow, you should be able to run the script from anywhere by typing line-counter.bat into the command prompt, followed\nby any arguments the script accepts.\n\nTo make the script executable as line-counter instead of line-counter.bat, you can create an alias in Windows:\n\n1. Open a command prompt.\n2. Run the following command:\n\n    ```bash\n    doskey line-counter=line-counter.bat $*\n    ```\n\nNote: This alias will only be available in the current session. To make it permanent, you can add it to your user's\nprofile script. For example, you can add the doskey command to your user's profile script, which is located at C:\n\\Users\\YourUsername\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1 for PowerShell or C:\n\\Users\\YourUsername\\Documents\\profile.ps1 for Command Prompt.\n\n## Usage\n\nThe script is intended to be run from the command line. It takes a directory to search, and optional arguments for files\nor directories to include or exclude, and file extensions to include or exclude.\n\nHere are the available command line arguments:\n\n- `directory`: The directory to search. This is a required argument.\n- `-i` or `--include`: Files or directories to include. This is an optional argument.\n- `-ix` or `--include-extensions`: File extensions to include. This is an optional argument.\n- `-e` or `--exclude`: Files or directories to exclude. This is an optional argument.\n- `-ex` or `--exclude-extensions`: File extensions to exclude. This is an optional argument.\n\nNote: Only one of `include` or `exclude`, and only one of `include-extensions` or `exclude-extensions` can be provided.\n\nFiles with no extensions are given the `.noext` extension by the script. This allows you to include or exclude such\nfiles using the `--include-extensions` or `--exclude-extensions` arguments respectively.\n\n## Examples\n\nHere are some examples of how to use the script:\n\n1. Count the lines in all files in a directory:\n    \u003cpre\u003epython main.py /path/to/directory\u003c/pre\u003e\n    \u003cpre\u003eline-counter /path/to/directory\u003c/pre\u003e\n2. Count the lines in all files in a directory, excluding any files in the venv directory and any files with a .txt\n   extension:\n    \u003cpre\u003epython main.py /path/to/directory --exclude venv --exclude-extensions .txt \u003c/pre\u003e\n    \u003cpre\u003eline-counter /path/to/directory -e venv -ex .txt\u003c/pre\u003e\n3. Count the lines in all Python files in a directory, including only files in the src directory:\n    \u003cpre\u003epython main.py /path/to/directory --include src --include-extensions .py \u003c/pre\u003e\n    \u003cpre\u003eline-counter /path/to/directory -i src -ix .py\u003c/pre\u003e\n\nThe script will then print the line counts for each file extension, sorted by the number of lines, and the total line\ncount.\n\n## License\n\nThis project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) file for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlalpha49%2Fline-counter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frlalpha49%2Fline-counter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frlalpha49%2Fline-counter/lists"}