Have you tried this?
using (DataConnection connection = new DataConnection())
{
var subfiles = (from f in connection.Get<Composite.Media.DBMediaFile>()
where f.FolderPath.Contains(oldFolder + "/")
select f).ToList();
foreach (var file in subfiles)
{
file.FolderPath = newFolder;
connection.Update<Composite.Media.DBMediaFile>(file);
}
}
(notice the .ToList() on line 5)