I had many directories under one directory with some files in each of them and I wanted to merge all the files together in a single directory. I created following C# file in a console application that has a _MoveFiles static method which peforms all the work.
Example Usage:
class Program
{
static void Main(string[] args)
{
string[] notToInclude = { "C:\\Program Files\\abc" };
MoveFiles._MoveFiles("C:\\Program Files\\abc",
"C:\\Program Files\\abc_target",
notToInclude,
null,
null,
false);
}
}
You can pass several criteria to define which directories to choose and which to ignore and which file extensions should be picked. And, if in the end the program should attempt to delete the directory (only possible if the directory gets empty).
MoveFiles
It can be further imporved but I have finished my work :)
No comments:
Post a Comment