Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

last access date for files

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-09-2007   #1 (permalink)
IT Staff
Guest


 

last access date for files

1) get-childitem | get-member

Looking at the System.IO.FileInfo, i m interested in getting the last
access date for file.

Is this the property : LastAccessTime ?


2.) i wish to retrieve last access time 14 days before the stipulated date.

how shld i retrieve it ?

get-childitem d:\directory | where-object {$_.lastaccesstime -gt 14days} ???



My System SpecsSystem Spec
Old 01-09-2007   #2 (permalink)
RichS
Guest


 

RE: last access date for files

LastAccessTime gives the last time the file was last accessed

LastWriteTime gives the last time the file was written to

to list the files need something like

get-childitem d:\directory | where{$_.lastaccesstime -gt
((get-date).adddays(-14))}
--
Richard Siddaway

Please note that all scripts are supplied "as is" and with no warranty


"IT Staff" wrote:

> 1) get-childitem | get-member
>
> Looking at the System.IO.FileInfo, i m interested in getting the last
> access date for file.
>
> Is this the property : LastAccessTime ?
>
>
> 2.) i wish to retrieve last access time 14 days before the stipulated date.
>
> how shld i retrieve it ?
>
> get-childitem d:\directory | where-object {$_.lastaccesstime -gt 14days} ???
>
>
>

My System SpecsSystem Spec
Old 01-10-2007   #3 (permalink)
Andrew Watt [MVP]
Guest


 

Re: last access date for files

On Tue, 9 Jan 2007 17:05:20 +0800, "IT Staff" <jkklim@hotmail.com>
wrote:

>1) get-childitem | get-member
>
>Looking at the System.IO.FileInfo, i m interested in getting the last
>access date for file.
>
>Is this the property : LastAccessTime ?


For ordinary files yes.

For SQL Server database files the LastAccessTime doesn't change to
reflect each access to a database.

Andrew Watt MVP
My System SpecsSystem Spec
Old 01-10-2007   #4 (permalink)
Andrew Watt [MVP]
Guest


 

Re: last access date for files

On Tue, 9 Jan 2007 17:05:20 +0800, "IT Staff" <jkklim@hotmail.com>
wrote:

>2.) i wish to retrieve last access time 14 days before the stipulated date.
>
>how shld i retrieve it ?


Richard has shown you a solution if you are interested in a date
range. If you want to see files written on a particular date use the
following as a basis:

get-childitem c:\* |
where-object {$_.lastaccesstime.date -eq
((get-date).date.adddays(-7))} |
format-table Name, LastAccessTime

It gives you files accessed 7 days ago i.e. on 3rd January (at the
time of writing).

Andrew Watt MVP
My System SpecsSystem Spec
Old 01-10-2007   #5 (permalink)
IT Staff
Guest


 

Re: last access date for files

In windows explorer, there is a coulmn called " Date modified"

Is that date refer to "lastwritetime" ?

For "lastaccesstime" , where is this information display ? is it somewhere
in windows explorer as well ?





"Andrew Watt [MVP]" <SVGDeveloper@aol.com> wrote in message
news:m5aaq2tmeupvr67nfjossck8qphbfbl3sm@4ax.com...
> On Tue, 9 Jan 2007 17:05:20 +0800, "IT Staff" <jkklim@hotmail.com>
> wrote:
>
>>2.) i wish to retrieve last access time 14 days before the stipulated
>>date.
>>
>>how shld i retrieve it ?

>
> Richard has shown you a solution if you are interested in a date
> range. If you want to see files written on a particular date use the
> following as a basis:
>
> get-childitem c:\* |
> where-object {$_.lastaccesstime.date -eq
> ((get-date).date.adddays(-7))} |
> format-table Name, LastAccessTime
>
> It gives you files accessed 7 days ago i.e. on 3rd January (at the
> time of writing).
>
> Andrew Watt MVP



My System SpecsSystem Spec
Old 01-11-2007   #6 (permalink)
Keith Hill [MVP]
Guest


 

Re: last access date for files

"IT Staff" <jkklim@hotmail.com> wrote in message
news:eod$opRNHHA.3668@TK2MSFTNGP02.phx.gbl...
> In windows explorer, there is a coulmn called " Date modified"
>
> Is that date refer to "lastwritetime" ?


Yes. Although it is also referred to as the last modified time.

> For "lastaccesstime" , where is this information display ? is it somewhere
> in windows explorer as well ?


Right click on the file in windows explorer and select Properties. It's
right there on the initial dialog box.

--
Keith


My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sort by date? And Folder missing files Aridale General Discussion 0 07-17-2008 04:59 AM
Video folder files have no date John Monahan Vista General 0 07-15-2008 09:58 PM
Sorting files by date modified Katharine Vista file management 2 02-05-2008 01:06 PM
All files and folders appearing under their date of creation Carnosaure Vista performance & maintenance 14 12-11-2007 12:40 PM
deleting files using a date criteria Walid PowerShell 4 10-22-2007 02:32 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51