Copy files and folders

  • Thread starter Thread starter Ian King
  • Start date Start date
I

Ian King

We need to copy a folder and its contents (including other folders), to
another location on our system when clicking a button on an Access form.
We've been unable to find a function to facilitate this, other than
'filecopy', which seems to copy only one item at a time.

Since the number and names of the files and subfolders within the folder is
variable, we can't hard code it.

Can anyone point us to a bit of code to solve this, or a method of using
'filecopy' recursively.

TIA

Ian King
 
Consider using the CopyFile API.

Randy Birch has a number of examples in the Copying section at
http://vbnet.mvps.org/code/fileapi/index.html

Obligatory warning: Randy's site is aimed at VB programmers. Since there are
differences in the form models between VB and Access, some of the examples
don't port cleanly. I believe some of these examples fall into that
category: he's using the AddItem method of the List boxes, and, depending on
what version of Access you're using, that won't work. However, that's not
relevant to the actual copying.
 
Just been to Randy Birch's site - WOW. Makes me want to learn proper VB
stuff. Not had a proper chance to go through all his samples, but I'm sure
the answer's there.

Many thanks for the info.

Ian King
 
Back
Top