public void SelectFile(string theDirectory) { getrefprojet(); string destinationFolder; OpenFileDialog openFileDialog1 = new OpenFileDialog(); DirectoryCreator dcr = new DirectoryCreator(); if (openFileDialog1.ShowDialog() == DialogResult.OK) { var fileName = openFileDialog1.FileName; destinationFolder = AppDomain.CurrentDomain.BaseDirectory + @"Projet\" + tempnumprojet + @"\Programme\" + RefProgramme + @"\Convention\" + inputNumDC.Text + @"\" + theDirectory + @"\" + System.IO.Path.GetFileName(openFileDialog1.FileName); dcr.CreateDirectoryConvention(tempnumprojet, RefProgramme, inputNumDC.Text + "/" + theDirectory); System.Windows.Forms.MessageBox.Show("operation réussi avec succès"); if (File.Exists(destinationFolder)) { File.Delete(destinationFolder); } File.Copy(fileName, System.IO.Path.Combine(System.IO.Path.GetDirectoryName(fileName), destinationFolder)); } else { System.Windows.MessageBox.Show("aucun fichier selectionner"); } }