QString sharedFolderPathImg = "\\\\"+ IP +"/profileImage/"; // 更换为你的共享文件夹路径
QDir dirImg(sharedFolderPathImg);
dirImg.setFilter(QDir::NoDotAndDotDot | QDir::AllEntries);
QVector<QString> curFileEntryArrayImg = dirImg.entryList().toVector();
for (auto filename : curFileEntryArrayImg)
{
QFile sharedFile(sharedFolderPathImg + filename);
QFile oldFile("C:/chenhe/profileImage/" + filename);
if (oldFile.exists()) {
oldFile.remove();
}
//qDebug() << filename;
sharedFile.copy("C:/chenhe/profileImage/"+ filename);
}
![在这里插入图片描述![](https://i-blog.csdnimg.cn/direct/beaa1211274741f3aa8eec647a493337.png)]