Please see the sample for your reference.
string sSearchContent = "Search Content";
string sSourceFilesDirectory = "Directory Path";
string sMoveFileDirectoryPath = "";
List<string> lstContentMatchedFile = new List<string>();
string [] arrFiles = Directory.GetFiles(sSourceFilesDirectory, "*.txt");
string sFileContent="";
foreach (string sFile in arrFiles)
{
sFileContent = File.ReadAllText(sFile);
if (sFileContent.Contains(sSearchContent))
{
lstContentMatchedFile.Add(sFile);
}
}
foreach (string sFile in lstContentMatchedFile)
{
File.Move(sFile, Path.Combine(sMoveFileDirectoryPath, Path.GetFileName(sFile)));
}