c# How to copy directory and subdirectories files to new location programmatically

Well when I started writing this function I had no Idea what to expect. I checked MSDN and I couldn’t find a function that can do this for me. I could be wrong because at midnight you can’t expect your brain to be working at peak 🙂

Alright so here is what I came up with. I will show you how you can use this function after defining the function

[geshi lang=”csharp” nums=”1″ target=”_self” ]

Lets see how we can use this function

[geshi lang=”csharp” nums=”1″ target=”_self” ]

 

You can pass optional param values as per requirement.

Above is an approach and you can off course always do better. If you would like to add something to this post please do so via leaving your comments.

I hope this helps

Cheers

Comments

  1. i am getting CopyDirectory error saying name does not exit in current context

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.