But I get a warning: Implicit string type conversion from "AnsiString" to "UnicodeString". It isn't really a problem (since the result is correct), but I wonder what I should write to avoid the warning.
Assuming you are using Lazarus, I know of two possibilities:
1-Hide the warning in this specific instance, using Lazarus IDE directive
{%H-} at the location the warning is generated. In this case exactly to the left side of the variable
path without leaving a space:
WriteLn('Traitement du répertoire "' + {%H-}path + '".');
2-Hide all instances by passing
-vm4104 to the compiler in the project options.
You'll see both if you right-click on that warning.