具有特定文件扩展名的Shell文件副本 [英] Shell File copy with particular file extension

查看:118
本文介绍了具有特定文件扩展名的Shell文件副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我已经编写了Shell代码,用于将一个位置复制到另一位置(文件的特定扩展名).

问题是下面的代码仅从根文件夹中获取所有txt文件,但我需要复制的所有txt扩展名文件(包括子文件夹)应复制到另一个文件夹中

我已附上我的代码段
在此先感谢


Hi All

I have written a Shell code for copy one location to another location( particular extension of files).

the problem is the below code only getting all txt file from the root folder only but what i need is i need to copy all the txt extension files including subfolder should copy into another folder

i have attached my code snippet
Thanks in Advance


LPCWSTR from;
LPCWSTR to;
from =L"C:\\from\\*.txt";
to =L"C:\\To";
WORD wFunc;
WORD wFlags = 0;
wFlags=NULL ;
wFunc = FO_COPY;
SHFILEOPSTRUCT shfo;
ZeroMemory(&shfo,sizeof(SHFILEOPSTRUCT));
shfo.hwnd=GetSafeHwnd();
shfo.wFunc=wFunc;
shfo.lpszProgressTitle =L"Test";
shfo.fFlags = static_cast<fileop_flags>(wFlags);
shfo.pFrom =from;
shfo.pTo =to;
int iRc=SHFileOperation(&shfo);

推荐答案

Windows API FindFirstFile(FindFirstFileEx)/FindNextFile/FindClose.请参阅:
http://msdn.microsoft.com/zh-我们/library/windows/desktop/aa364418%28v=vs.85%29.aspx [
This can be done with Windows API FindFirstFile (FindFirstFileEx) / FindNextFile / FindClose. Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364418%28v=vs.85%29.aspx[^].

—SA


这篇关于具有特定文件扩展名的Shell文件副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆