/// <summary>
/// Move files and Directory
/// </summary>
/// <param name="fromPath"></param>
/// <param name="toPath"></param>
/// <param name="addDateTimeSubFolder"></param>
Using System.IO;
public static void Move(string fromPath, string toPath, bool addDateTimeSubFolder)
{
if (string.IsNullOrEmpty(fromPath))
{
throw new ArgumentException($"'{nameof(fromPath)}' cannot be null or empty", nameof(fromPath));
}
if (string.IsNullOrEmpty(toPath))
{
throw new ArgumentException($"'{nameof(toPath)}' cannot be null or empty", nameof(toPath));
}
if (addDateTimeSubFolder)
{
var subFolder = DateTime.Now.ToString("YYYYMMDD");
Directory.Move(fromPath, toPath + @"" + subFolder);
}
else
{
Directory.Move(fromPath, toPath);
}
}