0

The following code is working, but I need to amend it so it moves all .txt files instead of just the test.txt file.

File.Move(@"C:\Desktop\test\test.txt", @"C:\Desktop\test\old\test.txt");

How can I amend it to do this?

It's moving them from the test folder to the test\old subfolder

davidjwest
  • 538
  • 3
  • 22
  • Get the directory.files collection from the directory you want to move then just do `.Where(x => x.EndsWith(".txt"));` – EpicKip Sep 26 '17 at 11:36

1 Answers1

1

whith this you can get all files with path and after that with for you can copy all files to your path

string[] files = System.IO.Directory.GetFiles(path, "*.txt");
Shahrooz Ansari
  • 2,637
  • 1
  • 13
  • 21