请问 怎样把一个目录下的所有扩展名为.rmvb的文件改为扩展名为.avi? 请问 怎么样 才能 把 给出一个目录 要求 把所有 扩展名为 .rmvb的文件 改成 .avi?此目录下 可能含有其他格式文件 但是只要求修改 .rmvb的文件 请问怎么处理 ? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 大哥 请写详细点可以吗? 我是一个菜鸟 什么都不会那void fun(CString path);//path为目录路径请大哥多多指教 ! use CFileFind;void Rename(CString strPath){CFileFind finder;strPath+=_T("\\*.*");if (finder.FindFirst(strPath)){ BOOL bContinue=TRUE; while (bContinue) { CString strFile; bContinue=finder.FindNextFile(strFile); if (finder.IsDirectory()==FALSE) { MyRenameFunc(finder.GetPathName()); } } }相关函数:PathGetFileName(); PathRemoveExtention(); 上边的哥哥 没告诉我 怎么判断 是否为 .rmvb的文件啊 其他的文件也不需要修改啊 void Rename(CString strPath){CFileFind finder;strPath+=_T("\\*.*");if (finder.FindFirst(strPath)){ BOOL bContinue=TRUE; while (bContinue) { CString strFile; bContinue=finder.FindNextFile(strFile); if (finder.IsDirectory()==FALSE) { CString strExtention; strExtension=::PathFindExtension(finder.GetPathName()); if (strExtension.CompareNoCase(_T(".rmvb")==0) { MyRenameFunc(finder.GetPathName()); } } } } //这是我临时写出来的,具体调用你还要看看MSDNvoid Rename(CString strPath){CFileFind finder;strPath+=_T("\\*.*");if (finder.FindFirst(strPath)){ BOOL bContinue=TRUE; while (bContinue) { CString strFile; bContinue=finder.FindNextFile(strFile); if (finder.IsDirectory()==FALSE) { CString strExtention; strExtension=::PathFindExtension(finder.GetPathName()); if (strExtension.CompareNoCase(_T(".rmvb")==0) { //MyRenameFunc(finder.GetPathName()); RenameExtension (finder.GetPathName(),_T(".avi")); } } } } 具体就是遍历+修改哪要想简单点就用DOS命令system("rename d:\\test\\*.rmvb *.avi") 谢谢各位帮助 bingo 哥哥的代码 运行错误 继续研究中 ...... view界面分栏搞不定,大牛帮忙看一下吧【我初学】 打印预览方向控制 请教版主:为什么我的可用分一直保持不变? 用对话框做了一个bmp图象浏览器,刷新有问题啊 请问SDK编程怎样使用BS_ICON,BS_IMAGE来设置按钮? CNN报道盖茨遭暗杀,据说是恶作剧,请进来看笑话 请教金山词霸消息设置,烦请帮忙,up也好 关闭系统??? 大家看看这篇文章:http://tech.sina.com.cn/it/e/2002-02-02/102103.shtml 哪儿有win32SDK下载? VC打开时出错。求助 完成端口 主线程等待连接的问题
{
CFileFind finder;
strPath+=_T("\\*.*");
if (finder.FindFirst(strPath))
{
BOOL bContinue=TRUE;
while (bContinue)
{
CString strFile;
bContinue=finder.FindNextFile(strFile);
if (finder.IsDirectory()==FALSE)
{
MyRenameFunc(finder.GetPathName());
}
}
}相关函数:
PathGetFileName();
PathRemoveExtention();
{
CFileFind finder;
strPath+=_T("\\*.*");
if (finder.FindFirst(strPath))
{
BOOL bContinue=TRUE;
while (bContinue)
{
CString strFile;
bContinue=finder.FindNextFile(strFile);
if (finder.IsDirectory()==FALSE)
{
CString strExtention;
strExtension=::PathFindExtension(finder.GetPathName());
if (strExtension.CompareNoCase(_T(".rmvb")==0)
{
MyRenameFunc(finder.GetPathName());
}
}
}
}
void Rename(CString strPath)
{
CFileFind finder;
strPath+=_T("\\*.*");
if (finder.FindFirst(strPath))
{
BOOL bContinue=TRUE;
while (bContinue)
{
CString strFile;
bContinue=finder.FindNextFile(strFile);
if (finder.IsDirectory()==FALSE)
{
CString strExtention;
strExtension=::PathFindExtension(finder.GetPathName());
if (strExtension.CompareNoCase(_T(".rmvb")==0)
{
//MyRenameFunc(finder.GetPathName());
RenameExtension (finder.GetPathName(),_T(".avi"));
}
}
}
}
要想简单点就用DOS命令system("rename d:\\test\\*.rmvb *.avi")