move old files powershell script RRS feed

  • Question

  • I have a PS script that returns a list of files that have been modified more than seven days ago. If I add | Move-Item -Path "C:\Old" I end up with an error.

    Get-ChildItem –Path  “C:\New” –Recurse | Where-Object LastWriteTime –lt (Get-Date).AddDays(-7)

    What I am missing?


    Wednesday, January 28, 2015 6:04 PM


  • Use robocopy instead of trying to write a script.

    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by jrv Wednesday, January 28, 2015 7:31 PM
    • Marked as answer by Bill_StewartModerator Wednesday, March 4, 2015 6:04 PM
    Wednesday, January 28, 2015 6:52 PM

All replies