This method doesn't work in cycle.
uses
Winapi.Windows,
Winapi.ShellApi,
System.SysUtils;
var
Command: PWideChar;
SearchRec: TSearchRec;
XLSdir, XLSXdir: string;
begin
try
XLSdir := ExtractFilePath(ParamStr(0)) + 'xls';
XLSXdir := ExtractFilePath(ParamStr(0)) + 'xlsx';
if FindFirst(XLSdir + '\*.xls', faAnyFile, SearchRec) = 0 then
repeat
if (SearchRec.Name = '.') or (SearchRec.Name = '..') then
continue;
WriteLn(SearchRec.Name);
Command := PChar('/c ""C:\Program Files\LibreOffice\program\soffice.exe" --convert-to xlsx "' + XLSdir + '\' + SearchRec.Name + '" -outdir "' + XLSXdir + '""');
ShellExecute(GetModuleHandle(nil), 'open', 'cmd.exe', Command, nil, SW_HIDE);
Sleep(1000);
until FindNext(SearchRec) <> 0;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Write(#13#10 + 'press any key to continue...');
ReadLn;
end.