Skip to content

Instantly share code, notes, and snippets.

@paranoidninja
Created April 6, 2023 14:25
Show Gist options
  • Save paranoidninja/f72a62fa2b6bf4fa16d6058455f0598d to your computer and use it in GitHub Desktop.
Save paranoidninja/f72a62fa2b6bf4fa16d6058455f0598d to your computer and use it in GitHub Desktop.
C# code written in a hurry to navigate directories on the basis of wildcards :D
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("[+] Changing to " + args[0] + args[1] + "\n");
foreach (string directory in Directory.GetDirectories(args[0], args[1])) // "C:\\", "vorf*"
{
Directory.SetCurrentDirectory(directory);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment