示例#1
0
        // If your activity returns a value, derive from CodeActivity<TResult>
        // and return the value from the Execute method.
        protected override void Execute(CodeActivityContext context)
        {
            if (!Directory.Exists(SourceDirectory.Get(context)))
            {
                throw new DirectoryNotFoundException();
            }

            if (!Directory.Exists(TargetDirectory.Get(context)))
            {
                Directory.CreateDirectory(TargetDirectory.Get(context));
            }

            foreach (var item in Directory.EnumerateFiles(SourceDirectory.Get(context)))
            {
                var filename   = Path.GetFileName(item);
                var targetFile = Path.Combine(TargetDirectory.Get(context), filename);
                File.Copy(item, targetFile);
            }
        }