Skip to content

Instantly share code, notes, and snippets.

@aviatrix
Created August 27, 2016 13:25
Show Gist options
  • Save aviatrix/39d48d897a74d5bf3dcb3ccc12c6c474 to your computer and use it in GitHub Desktop.
Save aviatrix/39d48d897a74d5bf3dcb3ccc12c6c474 to your computer and use it in GitHub Desktop.
<Query Kind="Statements">
<Reference>&lt;RuntimeDirectory&gt;\System.Dynamic.dll</Reference>
<Reference>&lt;RuntimeDirectory&gt;\System.Dynamic.Runtime.dll</Reference>
<Namespace>System</Namespace>
<Namespace>System.Collections</Namespace>
<Namespace>System.Collections.Generic</Namespace>
</Query>
var sourceDir = @"D:\Downloads\All Shows\The Big Bang Theory";
var files = Directory.GetFiles(sourceDir,"*",SearchOption.AllDirectories);
foreach (var file in files)
{
var createdOn = File.GetCreationTime(file);
if (createdOn < DateTime.Now.AddMonths(-10))
{
$"deleting {file}".Dump();
File.Delete(file);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment