c# - count the number of files older that 6 months -


i want write code return number (count) of files older 6 months.

i have script below returns files

any appreciated

code below

// check number of file in cps directory on s drive private void btncheck_click(object sender, eventargs e) {     {         listbox1.items.clear();         {         }          string[] files = system.io.directory.getfiles(@"s:\cps papers\"); // @"s:\cps papers\" c:\test\          this.listbox1.items.addrange(files);         textbox1.text = listbox1.items.count.tostring();         {         }     } } 

something this?

var files = directory.enumeratefiles(@"s:\cps papers\")     .select(f => new fileinfo(f))     .where(info => info.creationtime < datetime.now.addmonths(-6))     .select(info => info.name); 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -