fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace ForMailRu
  12. {
  13. public partial class Form1 : Form
  14. {
  15. string folder;
  16. public Form1()
  17. {
  18.  
  19. InitializeComponent();
  20. label1.Text = "";
  21. label2.Text = "";
  22. }
  23. async void MovesImages()
  24. {
  25. await Task.Run(() =>
  26. {
  27. if (label1.Text != "" && label2.Text != "")
  28. {
  29. //получаем файлы первой папки
  30. string[] massFile = SearchFilesP(label1.Text);
  31. //Путь до второй папки
  32. string folderath2 = label2.Text;
  33. folderath2 += "\\";
  34. //Осталась лишь механика переноса либо копирования файлов
  35. foreach (string filename in massFile)
  36. {
  37. System.IO.File.Copy(filename, folderath2 + System.IO.Path.GetFileName(filename));
  38. //Перемещение
  39. //System.IO.File.Move(filename, folderath2 + System.IO.Path.GetFileName(filename));
  40. }
  41. MessageBox.Show("Succes!", "Ok!", MessageBoxButtons.OK, MessageBoxIcon.Information);
  42. }
  43.  
  44. });
  45. }
  46. private void button1_Click(object sender, EventArgs e)
  47. {
  48. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  49. {
  50. folder = folderBrowserDialog1.SelectedPath;
  51. label1.Text = folder;
  52. }
  53. }
  54. string[] SearchFilesP(string Path)
  55. {
  56. return System.IO.Directory.EnumerateFiles(Path, "*.*", System.IO.SearchOption.AllDirectories)
  57. .Where(s => s.EndsWith(".png") || s.EndsWith(".jpg")).ToArray();
  58. }
  59. private void button2_Click(object sender, EventArgs e)
  60. {
  61. if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
  62. {
  63. folder = folderBrowserDialog1.SelectedPath;
  64. label2.Text = folder;
  65. }
  66. MovesImages();
  67. }
  68. }
  69. }
  70.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cs(4,14): error CS0234: The type or namespace name `Data' does not exist in the namespace `System'. Are you missing `System.Data' assembly reference?
prog.cs(9,22): error CS0234: The type or namespace name `Forms' does not exist in the namespace `System.Windows'. Are you missing `System.Windows.Forms' assembly reference?
prog.cs(13,34): error CS0246: The type or namespace name `Form' could not be found. Are you missing an assembly reference?
Compilation failed: 3 error(s), 0 warnings
stdout
Standard output is empty