|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
File Not AccessedI want to be able to find out the names of files that havn't been accessed
in the past X days... so I want to do something like this.. date.today - txtlastdays.txt 9/08/2006 - 30 days = X is this possible? Not sure what you mean by 9/08/2006 - 30 days = X days.
It would be rather something like MaxAccessDate=Today.AddDays(-x) That will give the date that is x days earlier than today. You can then use this date to filter the files you want... See The fileInfo class if the problem is to get the last access date... -- Patrice "Gabe Matteson" <gmattesonATinqueryDOTbiz> a écrit dans le message de news: eMDRkk10GHA.3***@TK2MSFTNGP04.phx.gbl...Show quoteHide quote >I want to be able to find out the names of files that havn't been accessed >in the past X days... > > so I want to do something like this.. > > date.today - txtlastdays.txt > > 9/08/2006 - 30 days = X > > is this possible? > Thanks!
It seems to add X to the days to todays date though, am i missing something? thanks!... Dim QueryTime As date QueryTime = Today.AddDays(-txNotAccessed.Text) If sFile.LastAccessTime = QueryTime Then MsgBox(sFile) End If Show quoteHide quote "Patrice" <scr***@chez.com> wrote in message news:%23qjyoz10GHA.1268@TK2MSFTNGP02.phx.gbl... > Not sure what you mean by 9/08/2006 - 30 days = X days. > > It would be rather something like > > MaxAccessDate=Today.AddDays(-x) > > That will give the date that is x days earlier than today. You can then > use this date to filter the files you want... > > See The fileInfo class if the problem is to get the last access date... > > -- > Patrice > > "Gabe Matteson" <gmattesonATinqueryDOTbiz> a écrit dans le message de > news: eMDRkk10GHA.3***@TK2MSFTNGP04.phx.gbl... >>I want to be able to find out the names of files that havn't been accessed >>in the past X days... >> >> so I want to do something like this.. >> >> date.today - txtlastdays.txt >> >> 9/08/2006 - 30 days = X >> >> is this possible? >> > > Well, to check this it would be really easy to just print out the value for
Query. IMO the problme is rather that you are using = instead of <= that is you'll have only files accessed exacltly x days ago. -- "Gabe Matteson" <gmattesonATinqueryDOTbiz> a écrit dans le message de news: uwW%23Mi40GHA.4***@TK2MSFTNGP05.phx.gbl...Show quoteHide quote > Thanks! > It seems to add X to the days to todays date though, am i missing > something? thanks!... > > Dim QueryTime As date > > QueryTime = Today.AddDays(-txNotAccessed.Text) > > If sFile.LastAccessTime = QueryTime Then > > MsgBox(sFile) > > End If > > > > > > > > > > > > > > > > "Patrice" <scr***@chez.com> wrote in message > news:%23qjyoz10GHA.1268@TK2MSFTNGP02.phx.gbl... >> Not sure what you mean by 9/08/2006 - 30 days = X days. >> >> It would be rather something like >> >> MaxAccessDate=Today.AddDays(-x) >> >> That will give the date that is x days earlier than today. You can then >> use this date to filter the files you want... >> >> See The fileInfo class if the problem is to get the last access date... >> >> -- >> Patrice >> >> "Gabe Matteson" <gmattesonATinqueryDOTbiz> a écrit dans le message de >> news: eMDRkk10GHA.3***@TK2MSFTNGP04.phx.gbl... >>>I want to be able to find out the names of files that havn't been >>>accessed in the past X days... >>> >>> so I want to do something like this.. >>> >>> date.today - txtlastdays.txt >>> >>> 9/08/2006 - 30 days = X >>> >>> is this possible? >>> >> >> > > "Gabe Matteson" <gmattesonATinqueryDOTbiz> schrieb: <URL:http://dotnet.mvps.org/dotnet/samples/filesystem/FileSystemEnumerator.zip>>I want to be able to find out the names of files that havn't been accessed >in the past X days... > > so I want to do something like this.. > > date.today - txtlastdays.txt > > 9/08/2006 - 30 days = X > > is this possible? + 'System.IO.File.GetLastAccessTime' + 'Now' + 'DateTime' ('Date'). -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Hiding a Property
LAN IP Visual Basic beginner question self-extracting files in .net Writing a brute force program using SendKeys.Send AxSHDocVw.AxWebBrowser events Adding row to data table in .net 2.0 Restricting the resizing of forms String quickie: Remove trailing space from each RichTextBox line? how to open a form in C# |
|||||||||||||||||||||||