Copy files and folders

G

Guest

In access I have created a folder relating to individual job records. When
the job is finished I want to be able to archive the folder and its contents
to a different location.

My question is, is there an easy way of copying the entire contents of a
particular folder and copy them to another directory. Types of files I would
be copying are word, excel and jpeg files and may be subfolders of the
directory.

Thanks in advance

Matt
 
D

David Lloyd

Matt:

One alternative is to use the FileSystemObject. This object has a
CopyFolder method that allows you to copy a folder and subfolders to a new
location. For example:

Dim fso As New Scripting.FileSystemObject

fso.CopyFolder "C:\Test2", "C:\Test3\", False

Set fso = Nothing

You will need a reference to the Microsoft Scripting Runtime to use the
FileSystemObject. Below is a MSDN reference for the CopyFolder method.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/jsmthCopyFolder.asp

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


In access I have created a folder relating to individual job records. When
the job is finished I want to be able to archive the folder and its contents
to a different location.

My question is, is there an easy way of copying the entire contents of a
particular folder and copy them to another directory. Types of files I would
be copying are word, excel and jpeg files and may be subfolders of the
directory.

Thanks in advance

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top