﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Soldier.Framework.Utils
{
    public class FolderUtils
    {
        public static void CreateFolder(string path)
        {
            if (Directory.Exists(path))
            {
                return;
            }
            Directory.CreateDirectory(path);
        }

        public static void MoveFolder(string sourcePath, string targetPath)
        {
            DirectoryInfo folder = new DirectoryInfo(sourcePath);
            if (folder.Exists)
            {
                folder.MoveTo(targetPath);
            }
        }

        public static bool IsExists(string folderPath)
        {
            return new DirectoryInfo(folderPath).Exists;
        }

        public static bool IsEmpty(string folderPath)
        {
            DirectoryInfo di = new DirectoryInfo(folderPath);
            return (di.GetFiles().Length + di.GetDirectories().Length) == 0;
        }
    }
}
