title: Copy and Rename files in WPF C#
body: <p>I'm using <code>System.Windows.Forms.OpenFileDialog</code> in my <strong>WPF</strong> application to select images. When user select an image, I'm displaying file name of selected file in a textbox as below.</p>
  <pre><code>            OpenFileDialog fileDialog = new OpenFileDialog();
              fileDialog.Title = &quot;Select image&quot;;
              fileDialog.InitialDirectory = &quot;&quot;;
              fileDialog.Filter = &quot;Image Files (*.gif,*.jpg,*.jpeg,*.bmp,*.png)|*.gif;*.jpg;*.jpeg;*.bmp;*.png&quot;;
              fileDialog.FilterIndex = 1;
              fileDialog.RestoreDirectory = true;
  
              if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
              {
                  txtImagePath.Text = fileDialog.FileName;
              }
  </code></pre>
  <p>I have a button as <code>Save</code> in my application. When user click on this button, I need to <strong>rename</strong> this file to another name and <strong>copy</strong> it to another directory in my hard drive.</p>
  <p>How can I achieve this?</p>