Parsing directory name and size from Windows "dir" command


How to write a regular expression to parse directory name and total file size from the output of Windows "dir" command?

Here is an example output of the "dir" command:



Here is a regular expression to parse file entries from output of the "dir" command on Windows systems: Note that:

Directory of ([^\r\n]+)   - capture the directory name
File\(s\)\s+([^\r\n]+)    - capture the total file size

Click the button to test this regular expression here online:

2013-02-01, 0👍, 0💬