Advertisement
Guest User

Untitled

a guest
Feb 9th, 2019
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12.  
  13. namespace WindowsFormsApplication1
  14. {
  15.     public partial class Form1 : Form
  16.     {
  17.         public Form1()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.  
  22.         private void button1_Click(object sender, EventArgs e)
  23.         {
  24.             var allFiles = Directory.GetFiles(textBox1.Text, "*.DTX", SearchOption.AllDirectories);
  25.             foreach (var file in allFiles )
  26.             {
  27.                 listBox1.Items.Add(file);
  28.             }
  29.             foreach (var file in allFiles)
  30.             {
  31.                 listBox1.SetSelected(0, true);
  32.                 textBox2.Text = Path.GetFileName(file);
  33.                 File.Delete(file);
  34.                 System.IO.File.Copy(textBox3.Text, file);
  35.                 listBox1.Items.Remove(listBox1.SelectedItem);
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement