Skip to content

Commit

Permalink
FileHandling.cs: Add IsDirectoryEmpty() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
samuel-lucas6 committed Jul 4, 2021
1 parent 41fe78b commit b372b27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/KryptorCLI/GeneralPurpose/FileHandling.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Sodium;
using System;
using System.IO;
using System.Linq;

/*
Kryptor: A simple, modern, and secure encryption tool.
Expand Down Expand Up @@ -51,6 +52,11 @@ public static bool IsDirectory(string filePath)
return fileAttributes.HasFlag(FileAttributes.Directory);
}

public static bool IsDirectoryEmpty(string directoryPath)
{
return !Directory.EnumerateFileSystemEntries(directoryPath).Any();
}

public static string[] GetAllDirectories(string directoryPath)
{
return Directory.GetDirectories(directoryPath, "*", SearchOption.AllDirectories);
Expand Down

0 comments on commit b372b27

Please sign in to comment.