-1
private void buttonSaveXML_Click(object sender, EventArgs e)
    {
        SaveFileDialog saveFile = new SaveFileDialog();
        saveFile.Filter = "XML Files|*.xml";
        saveFile.Title = "Save a Xml File";
        saveFile.InitialDirectory = @"C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\fxo\NewVersion";
        textBoxTargetFolder.Text = @"C:\Program Files (x86)\EdisonFactory\NetOffice";
        saveFile.ShowDialog();
        if (saveFile.FileName != "")
        {
            FileStream fs = (FileStream)saveFile.OpenFile();
            dsVersions.WriteXml(fs);
        }
        string sourceFileFolder = @"C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\fxo\NewVersion";
        string destinationFileFolder = @"C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\fxo\NewVersion";
        bool overwrite = true;
        File.Copy(sourceFileFolder, destinationFileFolder);
        {
            overwrite = true;
        }

I got that much done but i don't know what i am missing. Any help? The button saves XMLs but it also needs to get files from the selected files and copy/paste them where the xml file saves. Also there is an exception on File.Copy(sourceFileFolder, destinationFileFolder); How i need to copy is getting the path from one textbox and pasting it from a path into another textbox.

Baked Potato
  • 294
  • 1
  • 4
  • 17
  • What do you mean by copy/paste? Do you mean over the clipboard? Because right now you are physically copying the file from one location to another. – Wolfgang Ziegler Jul 25 '12 at 16:32
  • That isn't copy/paste, and what exceptions are you getting? Please be more clear on what you want to do. If the code you've provided has nothing to do with the rest of what you want to do, including it just confuses things. – Peter Ritchie Jul 25 '12 at 16:35
  • @PeterRitchie The code with the exception is in the code i posted, it is the 4th to last code there. – Baked Potato Jul 25 '12 at 16:37
  • @WolfgangZiegler Yes, i added some more details to make it a bit more clear. – Baked Potato Jul 25 '12 at 16:37
  • Don't expect people to download, compile, and run your code to figure out what the exception is. – Peter Ritchie Jul 25 '12 at 16:39
  • @PeterRitchie It doesn't say the exception, just shows that there is one. – Baked Potato Jul 25 '12 at 16:41
  • @SovietOnion: I'm pretty sure the runtime tells you what exception it's throwing. When you debug this, what type of exception is it? What is the message on the exception? – David Jul 25 '12 at 16:44

1 Answers1

1

You need to pass the individual filenames to File.Copy(), not just the directory. This appears to be a duplicate question. See here for answer:

Best way to copy the entire contents of a directory in C#

Community
  • 1
  • 1
Gambit
  • 2,455
  • 18
  • 20