Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Copying Folder

2 views
Skip to first unread message

Bob Mignault

unread,
Apr 12, 2009, 2:26:54 PM4/12/09
to
Medic is a folder.

What code would I use to copy folder C:\Program Files\Medic

to:

F:\Program Files

Regards,

Bob Mignault


MikeD

unread,
Apr 13, 2009, 2:58:46 PM4/13/09
to

"Bob Mignault" <rmig...@sympatico.ca> wrote in message
news:eYSLCx5u...@TK2MSFTNGP03.phx.gbl...

> Medic is a folder.
>
> What code would I use to copy folder C:\Program Files\Medic
>
> to:
>
> F:\Program Files
>

If you want to go with pure VB code, you'd need to use a combination of the
MkDir statement (to create the Medic folder in F:\Program Files), the Dir$()
function (to get all the files in C:\Program Files\Medic), the FileCopy
statement (to copy the files you found using Dir$), the Kill statement (to
delete the files in C:\Program Files\Medic) and the RmDir statement (to
remove the Medic folder in C:\Program Files). If Medic has any subfolders,
you'll need to work with those subfolders "on their own". If Medic has any
subfolders, and if those have any subfolders (etc., etc.), this can start to
get pretty messy.

There are also numerous Win32API functions you could use that would make
this much easier. For example, SHFileOperation, which is essentially the
exact same function Windows itself uses when copying, moving, deleting files
in Windows (for example, in an Explorer window). If you search the
newsgroups at www.google.com on that function name, you should finds tons of
example code for it.

--
Mike

0 new messages