protected override INode DoRenameTo(string name, bool overwrite)
        {
            string destPath;

            name = StringUriUtils.RemoveQuery(name);

            destPath = Path.Combine(this.directoryInfo.Parent.FullName, name);

            if (this.FileSystem.PathsEqual(destPath, this.directoryInfo.Parent.FullName, destPath.Length))
            {
                return(this);
            }

            for (var i = 0; i < 5; i++)
            {
                try
                {
                    if (overwrite)
                    {
                        Directory.Delete(destPath);
                    }

                    //
                    // Don't use FileInfo.MoveTo as it changes the existing FileInfo
                    // use the new path.
                    //

                    Directory.Move(this.directoryInfo.FullName, destPath);
                    this.directoryInfo.Refresh();

                    break;
                }
                catch (IOException)
                {
                    if (i == 4)
                    {
                        throw;
                    }

                    Thread.Sleep(500);
                }
            }

            return(this);
        }
        protected override INode DoRenameTo(string name, bool overwrite)
        {
            name = StringUriUtils.RemoveQuery(name);

            var destPath = Path.Combine(this.fileInfo.DirectoryName, name);

            for (var i = 0; i < 5; i++)
            {
                try
                {
                    if (overwrite)
                    {
                        File.Delete(destPath);
                    }

                    //
                    // Don't use FileInfo.MoveTo as it changes the existing FileInfo
                    // use the new path.
                    //

                    File.Move(this.fileInfo.FullName, destPath);
                    this.fileInfo.Refresh();

                    break;
                }
                catch (IOException)
                {
                    if (i == 4)
                    {
                        throw;
                    }

                    Thread.Sleep(500);
                }
            }

            return(this);
        }