Form3.cs 862 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System;
  2. using System.IO;
  3. using System.Runtime.InteropServices;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Windows.Forms;
  7. namespace FileWatcher
  8. {
  9. public partial class Form3 : Form
  10. {
  11. public Form3()
  12. {
  13. InitializeComponent();
  14. }
  15. private void Form3_Load(object sender, EventArgs e)
  16. {
  17. }
  18. private void button1_Click(object sender, EventArgs e)
  19. {
  20. GetFile(textBox1.Text);
  21. }
  22. void GetFile(string FilePath) {
  23. DirectoryInfo root = new DirectoryInfo(FilePath);
  24. DirectoryInfo[] dics = root.GetDirectories();
  25. for (int i = 0; i < dics.Length; i++)
  26. {
  27. GetFile(dics[i].FullName);
  28. richTextBox2.AppendText(dics[i].Name+"\n");
  29. }
  30. }
  31. }
  32. }