Exemplo n.º 1
0
        private static void FileWork(string directoryPath, XmlFileInfo fileInfo)
        {
            var filePath         = FilePathHelper.GetFilePath(directoryPath, fileInfo);
            var oldDirectoryPath = FilePathHelper.CombinePath(directoryPath, "old/");

            if (File.Exists(filePath) == false)
            {
                return;
            }

            if (Directory.Exists(oldDirectoryPath) == false)
            {
                Directory.CreateDirectory(oldDirectoryPath);
            }

            var oldFilePath = FilePathHelper.GetFilePath(oldDirectoryPath, fileInfo);

            if (File.Exists(oldFilePath))
            {
                File.Delete(oldFilePath);
            }

            File.Move(filePath, oldFilePath);
        }