Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Visual Basic .NET (http://www.programmingforums.org/forum19.html)
-   -   Copying files (http://www.programmingforums.org/showthread.php?t=11097)

NightShade01 Aug 16th, 2006 10:44 PM

Copying files
 
Ok Suppose i have two directories
dim source as string = "C:\MyFiles"
dim dest as string = "C:\Mybackup"

now if the MyFiles folder contains 5 documents:
file1.doc
file2.doc
file3.doc
file4.doc
file5.doc

I want to click a button, have it check to see if the dest exsists, if it does and there are files in it, get those files and copy them to the backup folder.
So far i have:

:

dim source as string = "C:\MyFiles"
dim dest as string = "C:\Mybackup"

if directory.exsists(source) then
      dim sFiles() as string
      sFiles = Directory.GetFiles(source, "*.doc", SearchOption.TopDirectoryOnly)

'Stuck here after getting the files
'array copy method of some sort?


AntiNinja Aug 16th, 2006 11:14 PM

:

xcopy C:\MyFiles C:\MyBackup /E
:D ..I dont know VB sorry, just thought I'd show you a quick and easy way.

bigguy Aug 17th, 2006 12:49 PM

MSDN has a example look under CopyFile method


All times are GMT -5. The time now is 12:44 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC