Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make robocopy regex compatible with languages other than english #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Make robocopy regex compatible with languages other than english #23

wants to merge 2 commits into from

Conversation

jantari
Copy link
Contributor

@jantari jantari commented Oct 29, 2020

I noticed on machines using a system language other than english, the folder sizes when using -UseRobo were all returning 0.

Looking into it, this was because the $expectedSummary regex did not match the output from non-english robocopy versions (yes, unfortunately Microsoft localizes many CLI tools in Windows ...)

I adapted the Regex to so that it should handle most languages.

A sample output from german robocopy is:

------------------------------------------------------------------------------

            Insgesamt    KopiertÜbersprungenKeine Übereinstimmung    FEHLER    Extras
Verzeich.:        239        239         0         0         0         0
  Dateien:       1892       1892         0         0         0         0
    Bytes: 2968068139 2968068139         0         0         0         0
   Zeiten:    0:00:00    0:00:00                       0:00:00   0:00:00
   Beendet: Donnerstag, 29. Oktober 2020 14:20:57

I replaced all "hardcoded" texts with [\w\.]+ because the .NET regex engine matches Umlauts as well as other international characters (such as 日本語) with \w and sometimes robocopy abbreviates long words with a . (as can be seen in the above example).

An example regex to test this is: 'Übereinstimm.日本語' -match '[\w\.]+'


I also defaulted the thred count to the processors available threads, because 16 might be a bit high for some (older) laptops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants