CK.Core.FileUtil.MoveToUniqueTimedFile C# (CSharp) Method

MoveToUniqueTimedFile() public static method

Moves (renames) a file to a necessarily unique named file. The file name is based on a DateTime, with an eventual uniquifier if a file already exists with the same name.
public static MoveToUniqueTimedFile ( string sourceFilePath, string pathPrefix, string fileSuffix, System.DateTime time, int maxTryBeforeGuid = 512 ) : string
sourceFilePath string Path of the file to move.
pathPrefix string The path prefix. Must not be null. Must be a valid path and may ends with a prefix for the file name itself.
fileSuffix string Suffix for the file name. Must not be null. Typically an extension (like ".txt").
time System.DateTime The time that will be used to create the file name. It must be an UTC time.
maxTryBeforeGuid int /// Maximum value for short hexadecimal uniquifier before using a base 64 guid suffix. Must greater than 0. ///
return string
        public static string MoveToUniqueTimedFile( string sourceFilePath, string pathPrefix, string fileSuffix, DateTime time, int maxTryBeforeGuid = 512 )
        {
            if( sourceFilePath == null ) throw new ArgumentNullException( "sourceFilePath" );
            if( !File.Exists( sourceFilePath ) ) throw new FileNotFoundException( Impl.CoreResources.FileMustExist, sourceFilePath );
            return FindUniqueTimedFile( pathPrefix, fileSuffix, time, maxTryBeforeGuid, p => TryMoveTo( sourceFilePath, p ) );
        }