/// <summary>
 /// Copies this file to a destination directory (async with cancellation token).
 /// </summary>
 public static Task CopyToAsync(this FileSystemFile source, FileSystemDirectory destination, CancellationToken cancellationToken)
 {
     return(source.FileSystem.CopyAsync(source.Path, destination.FileSystem, destination.Path.AppendFile(source.Path.EntityName), cancellationToken));
 }
        /// <summary>
        /// Gets a collection of entities in this <see cref="FileSystemDirectory"/>.
        /// </summary>
        public static ICollection <FileSystemEntity> GetEntities(this FileSystemDirectory directory)
        {
            var paths = directory.GetEntityPaths();

            return(new EnumerableCollection <FileSystemEntity>(paths.Select(p => FileSystemEntity.Create(directory.FileSystem, p)), paths.Count));
        }
 /// <summary>
 /// Copies this file to a destination directory (async).
 /// </summary>
 public static Task CopyToAsync(this FileSystemFile source, FileSystemDirectory destination)
 {
     return(source.CopyToAsync(destination, CancellationToken.None));
 }
 /// <summary>
 /// Copies this file to a destination directory.
 /// </summary>
 public static void CopyTo(this FileSystemFile source, FileSystemDirectory destination)
 {
     source.FileSystem.Copy(source.Path, destination.FileSystem, destination.Path.AppendFile(source.Path.EntityName));
 }
 /// <summary>
 /// Gets a collection of entities in this <see cref="FileSystemDirectory"/>.
 /// </summary>
 public static ICollection <FileSystemPath> GetEntityPaths(this FileSystemDirectory directory)
 {
     return(directory.FileSystem.GetEntities(directory.Path));
 }
 /// <summary>
 /// Moves this directory to a destination directory (async with cancellation token).
 /// </summary>
 public static Task MoveToAsync(this FileSystemDirectory source, FileSystemDirectory destination, CancellationToken cancellationToken)
 {
     return(source.FileSystem.MoveAsync(source.Path, destination.FileSystem, destination.Path.AppendDirectory(source.Path.EntityName), cancellationToken));
 }
 /// <summary>
 /// Moves this directory to a destination directory.
 /// </summary>
 public static void MoveTo(this FileSystemDirectory source, FileSystemDirectory destination)
 {
     source.FileSystem.Move(source.Path, destination.FileSystem, destination.Path.AppendDirectory(source.Path.EntityName));
 }