Wednesday, June 19, 2019
c# Move file to different directory
using System.IO;
static void MoveFileToFolder(FileInfo fi)
{
try
{
string moveToDir = Properties.Settings.Default.MoveToDirectory;
string fileName = fi.Name;
string FileAndPath = moveToDir + '/' + fileName;
if (File.Exists(FileAndPath))
{
File.Delete(FileAndPath);
}
fi.MoveTo(FileAndPath);
}
catch (Exception e)
{
Console.WriteLine("General Exception: {0}", e);
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment