private async Task <IScriptCommand> transferScriptCommandAsync(ParameterDic pm, IEntryModel[] srcEntries, IEntryModel destEntry, string destinationKey) { var progress = pm.GetProgress() ?? NullTransferProgress.Instance; var srcProfile = srcEntries.First().Profile as IDiskProfile; var destProfile = destEntry.Profile as IDiskProfile; var srcMapper = srcProfile.DiskIO.Mapper; var destMapping = destProfile.DiskIO.Mapper[destEntry]; List <IScriptCommand> notifyChangeCommands = new List <IScriptCommand>(); List <string> changedPath = new List <string>(); progress.Report(TransferProgress.IncrementTotalEntries(srcEntries.Count())); foreach (var srcEntry in srcEntries) { var srcMapping = srcMapper[srcEntry]; string destName = PathFE.GetFileName(srcMapping.IOPath); string destFullName = destProfile.Path.Combine(destEntry.FullPath, destName); progress.Report(TransferProgress.From(srcEntry.FullPath, destEntry.FullPath)); if (srcEntry.IsDirectory) { await ScriptRunner.RunScriptAsync(pm, ScriptCommands.Assign("{DT-SrcDirectory}", srcEntry, false, ScriptCommands.Assign("{DT-DestProfile}", destEntry.Profile, false, CoreScriptCommands.DiskParseOrCreateFolder("{DT-DestProfile}", destFullName, "{DT-DestDirectory}", IOScriptCommands.DiskTransferChild("{DT-SrcDirectory}", "{DT-DestDirectory}", RemoveOriginal, AllowCustomImplementation, ScriptCommands.Reset(ResultCommand.NoError, "{DT-DestDirectory}", "{DT-SrcDirectory}")))))); } else { await ScriptRunner.RunScriptAsync(pm, ScriptCommands.Assign("{DT-SrcFile}", srcEntry, false, ScriptCommands.Assign("{DT-SrcProfile}", srcEntry.Profile, false, ScriptCommands.Assign("{DT-DestProfile}", destEntry.Profile, false, CoreScriptCommands.DiskParseOrCreateFile("{DT-DestProfile}", destFullName, "{DT-DestFile}", CoreScriptCommands.DiskCopyFile("{DT-SrcProfile}", "{DT-SrcFile}", "{DT-DestProfile}", "{DT-DestFile}", ScriptCommands.Reset(ResultCommand.NoError, "{DT-SrcFile}", "{DT-DestFile}"))))))); } progress.Report(TransferProgress.IncrementProcessedEntries()); } logger.Info(String.Format("{0} {1} -> {2} using ScriptCommand", RemoveOriginal ? "Move" : "Copy", srcEntries.GetDescription(), destEntry.Name)); return(await GetAssignDestinationCommandAsync(pm, srcEntries, destEntry, destinationKey, NextCommand)); }