Below code is an example to select directory by TFileOpenDialog:

with TFileOpenDialog.Create(nil) do
	try
		Options := [fdoPickFolders];
		if Execute then
			ShowMessage(FileName);
	finally
		Free;
	end;

You can see another example at Simple function can select directory in Delphi