Skip to content

Instantly share code, notes, and snippets.

@icavalheiro
Last active March 20, 2019 17:27
Show Gist options
  • Select an option

  • Save icavalheiro/810686f40de1165c76afddf8a6dc7f84 to your computer and use it in GitHub Desktop.

Select an option

Save icavalheiro/810686f40de1165c76afddf8a6dc7f84 to your computer and use it in GitHub Desktop.
CSX script to delete all files that follow a pattern from the current directory
#!/usr/bin/env dotnet-script
/*
You will need dotnet core and "dotnet tool install -g dotnet-script"
*/
using System;
using System.IO;
var files = Directory.GetFiles("./", "._*", SearchOption.AllDirectories);
foreach (var file in files)
{
Console.WriteLine("deleting file: " + file);
File.Delete(file);
}
Console.WriteLine("Done");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment