Finding & copying files in folder/sub folders 
Author Message
 Finding & copying files in folder/sub folders

Hi,
 I need an efficient mechanism to find files with a
certain extension, say .txt, in a particular folder and
sub-folders under it.
After specifying the root directory, say C:\mydir,
I would like to search all for all *.txt files in it and
under it. Moreover, I need to copy them to a common folder
say, C:\myTemp.
Would FindFirstFile(), FindNextFile() be of any use?
Or is there a better way around?
Thanks in advance,
Sucharit


Mon, 11 Oct 2004 14:08:24 GMT  
 Finding & copying files in folder/sub folders

Quote:
>Would FindFirstFile(), FindNextFile() be of any use?

They are what you need.

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.



Mon, 11 Oct 2004 14:37:36 GMT  
 Finding & copying files in folder/sub folders
Hi Sucharit,

You should take a look at SHFileOperation()  It might help you do what
you're trying to do with very little extra code.  Basically, you set up a
structure (SHFILEOPSTRUCT) and then pass it to this function.  The cool
thing is that you get the basic shell pop up windows as well (like the one
throwing the files from one folder to another) which is nice feedback for
your user.

Tom


Quote:
> Hi,
>  I need an efficient mechanism to find files with a
> certain extension, say .txt, in a particular folder and
> sub-folders under it.
> After specifying the root directory, say C:\mydir,
> I would like to search all for all *.txt files in it and
> under it. Moreover, I need to copy them to a common folder
> say, C:\myTemp.
> Would FindFirstFile(), FindNextFile() be of any use?
> Or is there a better way around?
> Thanks in advance,
> Sucharit



Tue, 12 Oct 2004 01:22:55 GMT  
 Finding & copying files in folder/sub folders
Thanks to both of you.
Sucharit

Quote:
>-----Original Message-----
>Hi,
> I need an efficient mechanism to find files with a
>certain extension, say .txt, in a particular folder and
>sub-folders under it.
>After specifying the root directory, say C:\mydir,
>I would like to search all for all *.txt files in it and
>under it. Moreover, I need to copy them to a common
folder
>say, C:\myTemp.
>Would FindFirstFile(), FindNextFile() be of any use?
>Or is there a better way around?
>Thanks in advance,
>Sucharit
>.



Tue, 12 Oct 2004 12:46:26 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Help: Copying (sub)folders

2. How To copy & paste file folders

3. File/Folder path of a file/folder on the explorer

4. how can i get the list of all files/folders in a given folder

5. Programmatically Copy History Folder & ActiveDesktop Setup

6. Copying Files and/or Folders

7. Copy dependent files to bin folder

8. How to copy folders and files in Windows 95

9. FILE/FOLDER COPY QUESTION

10. How to copy all the files from a particular folder to another, thru VC++

11. How to copy folders and files in Windows 95

12. find last saved file in a folder and subfolders

 

 
Powered by phpBB® Forum Software