Skip to content

Instantly share code, notes, and snippets.

@maheshwaghmare
Last active June 17, 2019 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maheshwaghmare/a4ede7054b2ce5ee2708dd49bbd5a1a1 to your computer and use it in GitHub Desktop.
Save maheshwaghmare/a4ede7054b2ce5ee2708dd49bbd5a1a1 to your computer and use it in GitHub Desktop.
Line no count from each text file for the current directory on windows.

**Case: ** Count no of lines from each *.txt file from the files directory.

In files directory struture is below:

/files/
     - /test/
          -- log.txt
     - /test2/
          -- log.txt

First log.txt file contain 10 no of lines. Second log.txt file contain 5 no of lines.

Use command (for /r %f in (*.txt) do @type "%f") | find /c /v ""

E.g.

C:\xampp\htdocs\wpi18n\wp-content\files
λ (for /r %f in (*.txt) do @type "%f") | find /c /v ""
14

It shows 14 because of it starts from 0 (zero).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment