protected override void DoExecute()
        {
            if (_directoryAdapter.Exists(_dstDirPath.Value))
            {
                RetryUtils.RetryOnException(
                    new[] { typeof(UnauthorizedAccessException) },
                    _DeleteDstDirRetriesCount,
                    _DeleteDstDirRetryDelay,
                    () =>
                {
                    _directoryAdapter.GetDirectories(_dstDirPath.Value)
                    .Where(x => !_excludedDirs.Any(s => x.EndsWith(s, StringComparison.CurrentCultureIgnoreCase)))
                    .ToList()
                    .ForEach(dirPath => _directoryAdapter.Delete(dirPath, true));

                    _directoryAdapter.GetFiles(_dstDirPath.Value)
                    .ToList()
                    .ForEach(_fileAdapter.Delete);
                });
            }
            else
            {
                _directoryAdapter.CreateDirectory(_dstDirPath.Value);
            }
        }
        private static string FindLatestVersionDirPath(IDirectoryAdapter directoryAdapter, string baseDirPath)
        {
            Guard.NotNull(directoryAdapter, "directoryAdapter");
            Guard.NotNullNorEmpty(baseDirPath, "baseDirPath");

            string[] subDirs =
                directoryAdapter.GetDirectories(baseDirPath, "*.*", SearchOption.TopDirectoryOnly);

            var versionedFolders = new List <Tuple <VersionedFolder, string> >();

            foreach (string subDirPath in subDirs)
            {
                string subDir = Path.GetFileName(subDirPath) ?? "";
                Match  match  = _VersionedFoldeRegex.Match(subDir);

                if (!match.Success)
                {
                    continue;
                }

                string majorStr    = match.Groups["Major"].Value;
                string minorStr    = match.Groups["Minor"].Value;
                string revisionStr = match.Groups["Revision"].Value;
                string buildStr    = match.Groups["Build"].Value;
                string customStr   = match.Groups["Custom"].Value;
                string markerStr   = match.Groups["Marker"].Value;

                var versionedFolder =
                    new VersionedFolder(
                        int.Parse(majorStr),
                        int.Parse(minorStr),
                        int.Parse(revisionStr),
                        int.Parse(buildStr),
                        customStr,
                        !string.IsNullOrEmpty(markerStr) ? int.Parse(markerStr) : 0);

                versionedFolders.Add(new Tuple <VersionedFolder, string>(versionedFolder, subDirPath));
            }

            versionedFolders.Sort(
                (folder, otherFolder) =>
                Equals(folder.Item1, otherFolder.Item1)
          ? 0
          : folder.Item1.IsSmallerThan(otherFolder.Item1)
              ? 1
              : -1);

            Tuple <VersionedFolder, string> latestVersionedFolder =
                versionedFolders.FirstOrDefault();

            return
                (latestVersionedFolder != null
          ? latestVersionedFolder.Item2
          : null);
        }
        private static string FindLatestVersionDirPath(IDirectoryAdapter directoryAdapter, string baseDirPath)
        {
            Guard.NotNull(directoryAdapter, "directoryAdapter");
              Guard.NotNullNorEmpty(baseDirPath, "baseDirPath");

              string[] subDirs =
            directoryAdapter.GetDirectories(baseDirPath, "*.*", SearchOption.TopDirectoryOnly);

              var versionedFolders = new List<Tuple<VersionedFolder, string>>();

              foreach (string subDirPath in subDirs)
              {
            string subDir = Path.GetFileName(subDirPath) ?? "";
            Match match = _VersionedFoldeRegex.Match(subDir);

            if (!match.Success)
            {
              continue;
            }

            string majorStr = match.Groups["Major"].Value;
            string minorStr = match.Groups["Minor"].Value;
            string revisionStr = match.Groups["Revision"].Value;
            string buildStr = match.Groups["Build"].Value;
            string customStr = match.Groups["Custom"].Value;
            string markerStr = match.Groups["Marker"].Value;

            var versionedFolder =
              new VersionedFolder(
            int.Parse(majorStr),
            int.Parse(minorStr),
            int.Parse(revisionStr),
            int.Parse(buildStr),
            customStr,
            !string.IsNullOrEmpty(markerStr) ? int.Parse(markerStr) : 0);

            versionedFolders.Add(new Tuple<VersionedFolder, string>(versionedFolder, subDirPath));
              }

              versionedFolders.Sort(
            (folder, otherFolder) =>
            Equals(folder.Item1, otherFolder.Item1)
              ? 0
              : folder.Item1.IsSmallerThan(otherFolder.Item1)
              ? 1
              : -1);

              Tuple<VersionedFolder, string> latestVersionedFolder =
            versionedFolders.FirstOrDefault();

              return
            latestVersionedFolder != null
              ? latestVersionedFolder.Item2
              : null;
        }