Exemplo n.º 1
0
        public void Rename(string oldPath, string newPath, bool allowReplace = false)
        {
            if (File.Exists(newPath))
            {
                if (!allowReplace)
                {
                    Log.WarnFormat("Rename target exists (allowReplace='false') {0} => {1}", oldPath, newPath);
                    return;
                }
                File.Delete(newPath);
            }
            var dir = Path.GetDirectoryName(newPath);

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }
            _fileWrap.Move(oldPath, newPath);
        }