|
-
March 8th, 2009, 07:36 AM
#1
How to copy only new files from folder A to B(AppendConstrainLine, FileInfo.Exists )
So I want to copy only *new/edited* files from source folder to the destination folder. I can do a normal copy from from folder A to B. I also can the overwrite method.. But im stuck at this one:
Code:
DirectoryInfo dir = new DirectoryInfo(@"" + source);
FileInfo[] filesource = dir.GetFiles("*.*");
DirectoryInfo dir2 = new DirectoryInfo(@"" + destination);
FileInfo[] filedest = dir.GetFiles("*.*");
if (filesource[x].Exists && filesource[x].CreationTime )
if the file dose not exist in folder B then COPY
if the file does exist in folder B, but its creation time is older than the file in folder A, then COPY.
I found this: http://dotnetperls.com/Content/File-Copy-Backups.aspx but couldnt get it.
please help. thanx a lot guys!
Last edited by alexandergre; March 8th, 2009 at 07:39 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|