Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 637029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:34:46+00:00 2026-05-13T20:34:46+00:00

I need a script that can gather folders/files information from large drives (600GB to

  • 0

I need a script that can gather folders/files information from large drives (600GB to 1TB). The info that I will need are:

  • Full name/path of the file
  • File Size
  • Date Created
  • Date Modified
  • Date last accessed.

So far I have the code below:

dir 'e:\' -recurse | 
     select FullName,Length,CreationTime,LastWriteTime,LastAccessTime | 
     Export-CSV e:\test\testit.csv -notype

Would it be possible to get the script adapted so as it can search on ‘If modified date is equal to ‘xxx’ days or older, then output data to csv..

The xxx would be the figure – i.e 365 for 1 year or more old.. or xxx would be the figure – i.e 730 for 2 years or more old..

Also would it be possible to modify the headers for the columns that it outputs on CSV file?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:34:47+00:00Added an answer on May 13, 2026 at 8:34 pm

    For the first part of question, you might use

    # fixed date
    Get-ChildItem c:\temp\ | ? { $_.LastWriteTime -lt [datetime]'2009-02-23' }
    # variable depending on current date; it returns only items that are older than 365 days
    Get-ChildItem c:\temp\ | ? { $_.LastWriteTime -lt [datetime]::Now.AddDays(-365) }
    

    As for modifying the headers.. I is possible to select items with different names but with the same content (~rename the properties):

    Select-Object @{Name='ItemName'; Expression={$_.FullName } }, 
            @{Name='Write'; Expression={$_.LastWriteTime } }, 
            @{Name='Access'; Expression={$_.LastAccessTime } }
    

    Note that there is a script block where you can do whatever you want. You can e.g. format the dates {$_.LastAccessTime.ToString('yyyy-MM-dd') }


    If I put it together (there are only 3 properties ‘renamed’)

    Get-ChildItem e:\ -rec | 
        ? { $_.LastWriteTime -lt [datetime]::Now.AddDays(-365) } |
        Select-Object @{Name='ItemName'; Expression={$_.FullName } }, 
            @{Name='Write'; Expression={$_.LastWriteTime } }, 
            @{Name='Access'; Expression={$_.LastAccessTime } } |
        Export-Csv e:\test\testit.csv -notype
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a script that will take files from a user and
I need a simple proxy PHP function/script that can download a file from a
I need an script that can fetch data from a link like this: http://itunes.apple.com/app/monopoly/id337021781
I need to make a proxy script that can access a page hidden behind
I need to modify a php search script so that it can handle multiple
I need a script that will insert the current date and time in an
I need to write a script that incrementally keeps track of files and directories
So I need a Windows Script that I can tell it a directory to
I need to write a Ruby script that can take a collection of jpeg
I need to write a script that disables SQL Server Express 2008 from running.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.