c++ - 删除名称中包含单词的文件。C++
问题描述
有没有办法删除名称中包含一个单词的任何文件?例如:chrome.1323.pf 我想删除任何名称中包含 chrome 的文件。我试过这个:
if (GetAsyncKeyState(0x75)) {
std::string command = "del /Q ";
std::string path = "C:\\Windows\\Prefetch\\AUDIOZ.*.pf";
system(command.append(path).c_str());
}
但它并没有真正运作良好..
解决方案
您可以在要删除的文件名中提供通配符:
std::string command = "del /Q C:\\temp\\chrome*";
system(command);
推荐阅读
- cassandra - 添加新数据中心时,系统模式的 Cassandra 复制
- ios - Xcode Native UITests 在真实设备上非常慢
- html - CSS - 如何水平对齐我的 div?
- scala - 从 Scala 运行 cqlsh 脚本
- visualforce - 从命令按钮传递硬编码字符串作为参数并在 Apex 类中使用
- string - rust 中的 String::from 和 mut x = "some string" 有什么区别
- vba - Vba在MS word中创建“目录”并将其复制到excel表
- html - 文本缩进 - 在 Safari 中不显示文本
- javascript - 动态调整画布大小;将图像保持在原位
- arduino - ESP8266 开机模式:(3,7) 刷机后