Click here to Skip to main content
15,881,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
George Tourtsinakis27-Jul-15 1:18
George Tourtsinakis27-Jul-15 1:18 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
Richard MacCutchan27-Jul-15 1:34
mveRichard MacCutchan27-Jul-15 1:34 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
George Tourtsinakis27-Jul-15 2:10
George Tourtsinakis27-Jul-15 2:10 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
Richard MacCutchan27-Jul-15 2:12
mveRichard MacCutchan27-Jul-15 2:12 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
George Tourtsinakis27-Jul-15 8:42
George Tourtsinakis27-Jul-15 8:42 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
Pete O'Hanlon27-Jul-15 9:53
mvePete O'Hanlon27-Jul-15 9:53 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
George Tourtsinakis28-Jul-15 0:14
George Tourtsinakis28-Jul-15 0:14 
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
Pete O'Hanlon28-Jul-15 0:37
mvePete O'Hanlon28-Jul-15 0:37 
Okay, you can take advantage of the fact that Directory.CreateDirectory only creates a directory if it doesn't exist so you could do the following:
C#
private void CopyFiles(string sourceDirectory, string targetDirectory)
{
  Directory.CreateDirectory(targetDirectory);
  string[] files = Directory.GetFiles(sourceDirectory, "*.*", SearchOption.AllDirectories);
  foreach (string file in files)
  {
    string targetFile = Path.Combine(targetDirectory, file.Replace(sourceDirectory, string.Empty));
    File.Copy(file, targetFile);
  }
}
I've just typed this into the editor, so you might need to fix a syntax mistake or two, but this should roughly do what you're trying to accomplish.
GeneralRe: How to copy and replace folder in desktop with C#/Winforms? Pin
George Tourtsinakis29-Jul-15 6:08
George Tourtsinakis29-Jul-15 6:08 
Questionintegrate payment gate away in asp.net website Pin
Member 1185937025-Jul-15 4:00
Member 1185937025-Jul-15 4:00 
AnswerRe: integrate payment gate away in asp.net website Pin
OriginalGriff25-Jul-15 4:13
mveOriginalGriff25-Jul-15 4:13 
AnswerRe: integrate payment gate away in asp.net website Pin
F-ES Sitecore25-Jul-15 9:20
professionalF-ES Sitecore25-Jul-15 9:20 
AnswerRe: integrate payment gate away in asp.net website Pin
George Tourtsinakis27-Jul-15 8:53
George Tourtsinakis27-Jul-15 8:53 
QuestionHello i need help for menustrip change theme Pin
Member 1186131324-Jul-15 7:02
Member 1186131324-Jul-15 7:02 
AnswerRe: Hello i need help for menustrip change theme Pin
OriginalGriff24-Jul-15 8:11
mveOriginalGriff24-Jul-15 8:11 
AnswerRe: Hello i need help for menustrip change theme Pin
Afzaal Ahmad Zeeshan24-Jul-15 8:11
professionalAfzaal Ahmad Zeeshan24-Jul-15 8:11 
QuestionText to Audio in C#? Pin
Shailendra Singh Chauhan24-Jul-15 3:06
Shailendra Singh Chauhan24-Jul-15 3:06 
AnswerRe: Text to Audio in C#? Pin
Wendelius24-Jul-15 3:40
mentorWendelius24-Jul-15 3:40 
GeneralRe: Text to Audio in C#? Pin
Shailendra Singh Chauhan24-Jul-15 6:03
Shailendra Singh Chauhan24-Jul-15 6:03 
AnswerRe: Text to Audio in C#? Pin
Dave Kreskowiak24-Jul-15 3:48
mveDave Kreskowiak24-Jul-15 3:48 
GeneralRe: Text to Audio in C#? Pin
Shailendra Singh Chauhan24-Jul-15 6:02
Shailendra Singh Chauhan24-Jul-15 6:02 
AnswerRe: Text to Audio in C#? Pin
Afzaal Ahmad Zeeshan24-Jul-15 8:10
professionalAfzaal Ahmad Zeeshan24-Jul-15 8:10 
GeneralRe: Text to Audio in C#? Pin
Shailendra Singh Chauhan24-Jul-15 17:08
Shailendra Singh Chauhan24-Jul-15 17:08 
Questionchange focous when enter texbox Pin
Cenator23-Jul-15 23:14
Cenator23-Jul-15 23:14 
AnswerRe: change focous when enter texbox Pin
OriginalGriff23-Jul-15 23:26
mveOriginalGriff23-Jul-15 23:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.