DirectoryInfo dir = new DirectoryInfo(@"D:\Vivek"); FileInfo[] files = dir.GetFiles(); foreach (FileInfo file in files) { if (file.Length > 0) { // you can delete file here if you want (destination file) if (File.Exists(@"D:\Vivek\Moved\" + file.Name)) { File.Delete(@"D:\Vivek\Moved\" + file.Name); } // then copy the file here file.MoveTo(@"D:\Vivek\Moved\" + file.Name); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)