-2

I am trying to find out whether the file in the folder existed for morethan 30 minutes or not.I need find the difference between current system time and file created time in powershell.Please help m eout

Ironman
  • 556
  • 3
  • 7
  • 21

1 Answers1

1

This will return the minutes since the files had been copied.

 $($(Get-Date) - $(gci filename).CreationTime).Minutes
Musaab Al-Okaidi
  • 3,734
  • 22
  • 21
  • Please tell how to get the list of files in a folder(may contain subfolder) which are 30 min old – Ironman Sep 27 '13 at 00:18
  • 2
    this line of code works for a single file, you can use it in a loop. Show a bit of effort and some code so people can help you out. – Musaab Al-Okaidi Sep 27 '13 at 08:13
  • the above code will not solve my problem i have figure it out.any ways thanks for your answer and i know how to code ((Get-Date) - $_.CreationTime).TotalMinutes -gt $minsOld it should be total minutes not minutes – Ironman Oct 02 '13 at 23:15