Powershell script to list last modified files in x days

Let’s say you want to list of files from directory which are modified in last 2 to 3 days with certain extensions. like I would like to list all php files from directory C:\development modified in last 2 days

following PS command gives me exactly that.

PS> C:
PS> cd development
PS> $dtCompare = (Get-Date).AddDays(-3)
PS> get-childitem –recurse | where-object {$_.lastwritetime -gt $dtCompare -and $_.extension -eq “.php”}

Advertisements

2 thoughts on “Powershell script to list last modified files in x days

    • hi someone,

      I do blogging for my reference so that I don’t have go to google and find the perfect answer and yes I might have copied some of the answers from stack-overflow.
      I’ll start updating post with reference post when part of post is copied from other source.

      Thanks for raising your concern.

      Regards,
      Jignesh

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s