Dev2.PathOperations.Dev2ActivityIOBroker.TransferDirectoryContents C# (CSharp) Method

TransferDirectoryContents() private method

Transfer the contents of the directory
private TransferDirectoryContents ( IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst, Dev2CRUDOperationTO args ) : bool
src IActivityIOOperationsEndPoint
dst IActivityIOOperationsEndPoint
args Dev2CRUDOperationTO
return bool
        bool TransferDirectoryContents(IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst,
                                               Dev2CRUDOperationTO args)
        {
            ValidateSourceAndDestinationContents(src, dst, args);

            if(args.DoRecursiveCopy)
            {
                RecursiveCopy(src, dst, args);
            }

            var srcContents = src.ListFilesInDirectory(src.IOPath);
            var result = true;
            var origDstPath = Dev2ActivityIOPathUtils.ExtractFullDirectoryPath(dst.IOPath.Path);

            if(!dst.PathExist(dst.IOPath))
            {
                CreateDirectory(dst, args);
            }

            // get each file, then put it to the correct location
            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach(var p in srcContents)
            {
                result = PerformTransfer(src, dst, args, origDstPath, p, result);
            }
            Dev2Logger.Log.Debug(string.Format("Transfered: {0}", src.IOPath.Path));
            return result;
        }