Created
April 6, 2023 14:18
-
-
Save paranoidninja/3353cb5ba4fda40374f006dc0eaf9c78 to your computer and use it in GitHub Desktop.
C# code written in a hurry to list directories on the basis of wildcards :D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
namespace listfiles | |
{ | |
public static class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
if (args.Length == 0) { | |
Console.WriteLine("Usage: listfiles.exe <basepath> <wildcard-path>\nEg: listfiles.exe C:\\ vorf*"); | |
} else { | |
Console.WriteLine("[+] Listing " + args[0] + args[1] + "\n"); | |
foreach (string directory in Directory.GetDirectories(args[0], args[1])) // "C:\\", "vorf*" | |
{ | |
string[] files = Directory.GetFiles(directory, "*.*", SearchOption.AllDirectories); | |
// Display all the files. | |
foreach (string file in files) { | |
Console.WriteLine(file); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment