Click here to Skip to main content
14,382,301 members
Rate this:
Please Sign up or sign in to vote.
I have created a WPF application.

In this application I am copying files synchronously as follows.
using (FileStream SourceStream = File.Open(sourceFilePath, FileMode.Open))
	using (FileStream DestinationStream = File.Create(destinationFilePath))
		await SourceStream.CopyToAsync(DestinationStream);

But after successful asynchronous file copy my destination file properties which are CreationTime,LastAccessTime, LastWriteTime, Owner, computer etc. are not matching with source file properties.

This is all happening because SourceStream.CopyToAsync() method is writing file as stream to the destination.

I can copy files using the FileSystem.CopyFile()/FileSystem.CopyDirectory() which can give me the same properties of the source file to the destination file, But here the problem is UI will be blocked till the completion of all files copy.

How can I copy files asynchronously along with both source and destination file properties are same.
Updated 10-Dec-15 23:33pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100