ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

How old is this file?

(1/2) > >>

nkormanik:
Looking for a little snack program that does the following:

-- Place shortcut to it in SendTo list.

-- Send a file to it.

-- Up pops window saying how old the file is.

-- Days.  Hours.  Minutes.

Any help or thoughts appreciated!

Nicholas Kormanik


magician62:
I tend to just properties a file to get a date. as I do the age bit in my head, and rarely care about Hours and Minutes

I can't code anything, but can prompt a couple of questions that may arise.

The important thing is how are you determining the age of the file?

Days since created?
Days since modified?

Date created is NOT always the older of the two? File copied form another location for example.

nkormanik:
The files are freshly created, less than 38 hours old, so far.  Creation Date and Modified Date appear to be the same.  Either one will do.

I've been searching on the Internet and no one out there seems to have come up with a solution, though it seems so easy -- Current Time minus (say) Creation Date.

No big deal.  Just wondered if someone here could whip it out.

4wd:
DaysSince.ps1

How old is this file?

Shortcut in the archive, (assuming Win10), drop it into C:\Users\<user>\appdata\roaming\microsoft\windows\sendto - you'll need to edit the target path to the PowerShell script if it's different from C:\PoSh (my test folder).

Shortcut target:

--- Code: Text ---C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -WindowStyle Hidden -File C:\PoSh\DaysSince.ps1

--- Code: PowerShell ---<#  DaysSince.ps1 <file>#> Param (  $SourceFile) $fp = (Get-ItemProperty -Path $SourceFile) $deltaM = (New-TimeSpan -Start $fp.LastWriteTime -End (Get-Date))$deltaC = (New-TimeSpan -Start $fp.CreationTime -End (Get-Date)) $text = "$([io.path]::GetFileName($SourceFile))`r`nTime since:`r`nCreation:`t`t$($deltaC.Days) Days, $($deltaC.Hours) Hours, $($deltaC.Minutes) Minutes`r`n"$text += "Modification:`t$($deltaM.Days) Days, $($deltaM.Hours) Hours, $($deltaM.Minutes) Minutes" $wshell = New-Object -ComObject Wscript.Shell -ErrorAction Stop$wshell.Popup($text, 0, "DaysSince", 64) | Out-Null
NOTE: I'm running PowerShell 5.x, I don't know if it will work on a lower version.

No doubt there'll be some Windows weirdness that will stop it from running, took ages to work out why it wasn't passing files with spaces in.

And no doubt you'll run afoul of PowerShell's stringent ExecutionPolicy setting, if that happens change the Shortcut Target to:

--- Code: Text ---C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File C:\PoSh\DaysSince.ps1

Curt:
I have certain files in "Last Used..." order. If I want to know more about the various dates, concerning a file, I right-click it and click "FileMenu Tools..." > "Change File Time". Clicking it, does of course not mean I also would have to change anything. But it will tell me some important dates;


How old is this file?

€10 https://www.lopesoft.com/index.php/en/products/filemenutools

Navigation

[0] Message Index

[#] Next page

Go to full version