Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Query Kind="Statements">
- <Reference><RuntimeDirectory>\System.Dynamic.dll</Reference>
- <Reference><RuntimeDirectory>\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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement