Esempio n. 1
0
        protected override bool OnStepStart()
        {
            try
            {
                if (Directory.Exists(NewDirectoryPath))
                {
                    if (Overwrite)
                    {
                        Directory.Delete(NewDirectoryPath, true);
                    }
                    else
                    {
                        return(true);
                    }
                }

                // create a destination folder if it doesn't exist
                if (!Directory.Exists(DestinationDirectory))
                {
                    Directory.CreateDirectory(DestinationDirectory);
                }

                Directory.Move(SourceDirectoryPath, NewDirectoryPath);
            }
            catch (Exception exception)
            {
                RockLog.LogException(exception);
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        /// <inheritdoc />
        protected override bool OnStepStart()
        {
            try
            {
                bool destinationFileExists = File.Exists(DestinationFilePath);

                // delete the destination file path if it already exists, otherwise, consider this step finished
                if (Overwrite && destinationFileExists)
                {
                    File.Delete(DestinationFilePath);
                }
                else if (!Overwrite && destinationFileExists)
                {
                    return(true);
                }

                File.Move(SourceFilePath, DestinationFilePath);
            }
            catch (Exception exception)
            {
                RockLog.LogException(exception);
                return(false);
            }

            return(true);
        }