Search results: How to display seconds in date columns?

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
maxwi
Posts: 3
Joined: Thu Sep 25, 2014 12:40 pm

Search results: How to display seconds in date columns?

Post by maxwi »

Search results, date columns:
Is it possible to show the time including seconds?

'date hh:mm:ss'

How?
void
Developer
Posts: 16753
Joined: Fri Oct 16, 2009 11:31 pm

Re: Search results: How to display seconds in date columns?

Post by void »

Please try changing the Everything time format:
In Everything, type in the following search and press ENTER:
/time_format=hh:mm:ss
maxwi
Posts: 3
Joined: Thu Sep 25, 2014 12:40 pm

Re: Search results: How to display seconds in date columns?

Post by maxwi »

Works perfectly.
Excellent customizing options.
Thank you!
HerbM
Posts: 13
Joined: Tue Feb 27, 2018 3:18 am

Re: Search results: How to display seconds in date columns?

Post by HerbM »

Came to find out if es.exe (Commandline) could format a sortable date and saw this.

Didn't see the answer and the syntax that worked in the GUI didn't seem to have an effect.

Work around: In Windows TIme Settings (click on task bard time/clock). set the date and time formats there.

I noticed by reading the cli.c source code to es.exe that it had a "to-do" for custom time formats but also was using/respecting the System LOCALE.

Nice. Once again, Everything and ES exceed expectations.



FYI: Sortable dates (as a first step to custom date/time varieties) would be VERY NICE. I've been piping the output of ES to PowerShell to get an "object" that I could easily sort (or format). Which isn't a bad trick for others to know in any case.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Search results: How to display seconds in date columns?

Post by NotNull »

HerbM wrote:Sortable dates (as a first step to custom date/time varieties) would be VERY NICE.
Take a look at the options of ES.exe. Among those are options to sort the results.
Example:
es.exe test ext:txt -sort date-modified -sort-descending
or somewhat shorter:
ES.EXE test ext:txt /o-d


HerbM wrote: I've been piping the output of ES to PowerShell to get an "object" that I could easily sort (or format). Which isn't a bad trick for others to know in any case.
Could you provide an example? (I do know how that works, but maybe other people here don't)
HerbM
Posts: 13
Joined: Tue Feb 27, 2018 3:18 am

Re: Search results: How to display seconds in date columns?

Post by HerbM »

> Coule you provide an example of how that works? (for others...)

Sure.

First of all there are ways to do much of this in es.exe directly. But not everything can be done in everything (yet?), so knowing how to use es.exe and PowerShell together is a very useful skill set.

Here's a sorted datetime for finding all the copies of 7z on your system. BTW, this is a good idea to try, as there were bugs/security issues in previous versions of 7Zip and it's astounding how many programs load 7z privately.
es 7z.exe -dm -sort-datemodified-ascending
If we didn't know how to do it the we could use PowerShell to "help" like this:
es 7z.exe | Get-ChildItem | Sort-Object LastWriteTime | Select-Object Length,LastWriteTime,Name,Directory
es 7z.exe | dir | Sort LastW*e | Select Len*,LastW*E,Name,Dir*E # alternative with less typing
That Get-ChildItem might seem unnecessary, given that es.exe is already sending the filenames, but the issue is that PowerShell can do far more with "Objects" than with simple strings.

By sending the es.exe output through Get-ChildItem we send an OBJECT down the pipeline. Objects require no parsing, so we can manipulate the MEMBER PROPERTIES (or even methods) directly and easily

After that, the rest is obvious: Get the file, sort, select the properties we want to display (or pass to another command.)

Selecting the properties is optional, but in most cases like this you will prefer it to outputting either the entire "object" (all properties" or whatever is the DEFAULT formatted display of that object type. However, it's YOUR option.

Another idea that es.exe doesn't do (AFAIK) is to find "File versions", but PowerShell can do this easily, and once we know the patterns above we can enter the command easily as well.

Code: Select all

es 7z.exe | dir | Sort LastWriteTime | Select -expand VersionInfo

ProductVersion   FileVersion      FileName
--------------   -----------      --------
18.05            18.05            C:\ProgramData\Local\Julia\bin\7z.exe
18.05            18.05            C:\util\7-Zip\App\7-Zip64\7z.exe
18.05            18.05            C:\util\7z.exe
18.05            18.05            C:\ProgramData\chocolatey\tools\7z.exe
18.05            18.05            C:\Program Files\Unity\Editor\Data\Tools\7z.exe
                                  C:\ProgramData\chocolatey\lib\openssh\tools\7z.exe.ignore
9.20             9.20             C:\Users\A469526\Downloads\CSScriptNpp.Updater\7z.exe
There were a lot more, and you can see that some have no versions or that 9.20 that snuck through and I need to replace.

What's new here? Adding "-expand" to Select-Object for the VersionInfo. VersionInfo itself is a "complex object" so simply selecting it won't give good results. We need to "EXPAND" out the VersionInfo properties.

Adding the datetime from the main FileInfo object to the VersionInfo object is a bit trickier (though not too difficult).

It's on my "to do" list so if there is interest I can work that out and post it in a followup.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Search results: How to display seconds in date columns?

Post by NotNull »

Thanks for your (very well written) explanation!

HerbM wrote:Adding the datetime from the main FileInfo object to the VersionInfo object is a bit trickier (though not too difficult).
It's on my "to do" list so if there is interest I can work that out and post it in a followup.
I don't want to steal your thread and/or ruin your fun, so this is a 'hidden' text for one way to get this done. (select the text show)


Select has a nice option to create your own "fields" to report (also available in other commands, btw)
You can use it like this (just an example):

.\es.exe 7z.exe | gi | select LastWriteTime, FullName, @{LAbel = "Version";Expression = {$_.VersionInfo.FileVersion}}, Length

( gi = Get-Item ; select = Select-Object )

HerbM
Posts: 13
Joined: Tue Feb 27, 2018 3:18 am

Re: Search results: How to display seconds in date columns?

Post by HerbM »

First and foremost, I love Everything (es really) - it's become part of my everyday workflow for so many things. 'Everyday' actually understates it, there's almost not an hour goes by that I don't use it. (MORE often that that really.)

I live at the command line -- for everything (heh heh) except Email, Browsing Inet, and Editing, but even for those I do much of my work from the command line -- opening files to edit from the console (PowerShell).
I don't want to steal your thread and/or ruin your fun, so this is a 'hidden' text for one way to get this done. (select the text show)
Won't steal my thread or fun -- I love this stuff and your method is the basis of what I was expecting to do.

Unfortunately, no one else seems very interested. The thread would be MORE FUN if people would jump in, ask questions and give their own ideas.
Select has a nice option to create your own "fields" to report (also available in other commands, btw)
You can use it like this (just an example):

.\es.exe 7z.exe | gi | select LastWriteTime, FullName, @{LAbel = "Version";Expression = {$_.VersionInfo.FileVersion}}, Length

( gi = Get-Item ; select = Select-Object )
Excellent.

And those that don't do PowerShell much will find it tedious to type all of that repeatedly, but PowerShell can fix that really easily -- with a function or cmdlet.

My first version was based on this pattern (similar to yours):

Code: Select all

es 7z.exe | dir | ForEach { $LWT = $_.LastWriteTime.ToString('yyyy-MM-dd HH:mm'); $Len=$_.Length; $_ } | Select -expand VersionInfo | Select  ProductVersion,@{N='LastWriteTime';E={$LWT}}, @{N='Length';E={$Len}},FileName | Sort LastWriteTime

ProductVersion LastWriteTime    Length FileName
-------------- -------------    ------ --------
18.05          2018-04-30 07:00 461824 C:\ProgramData\chocolatey\tools\7z.exe
18.05          2018-04-30 07:00 461824 C:\ProgramData\chocolatey\lib\openssh\tools\7z.ex
18.05          2018-04-30 07:00 461824 C:\ProgramData\chocolatey\lib\chocolatey\tools\ch
18.05          2018-04-30 07:00 461824 C:\util\7-Zip\App\7-Zip64\7z.exe
18.05          2018-04-30 07:00 461824 C:\util\7-Zip\App\7-Zip\7z.exe
18.05          2018-04-30 07:00 461824 C:\util\7z.exe
18.05          2018-04-30 07:00 461824 C:\esb\old\saveTRGRunbook\7z.exe
18.05          2018-04-30 07:00 461824 C:\esb\tt\TRGRunbook\7z.exe
18.05          2018-04-30 07:00 461824 C:\esb\trgrunbookTEMP\7z.exe
18.05          2018-04-30 07:00 461824 C:\Program Files\Unity\Editor\Data\Tools\7z.exe
I have a nearly finished (but workable) version that does ES output, regular file listings, Services and Processes.

Again, if there's interest I can post that.
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Search results: How to display seconds in date columns?

Post by NotNull »

HerbM wrote: Thu Nov 01, 2018 11:20 pm I live at the command line
Same here! :) (but probably not as much as you do).

This might fit in your workflow then:

Code: Select all

function QCD
{
es.exe -sort run-count folder: !c:\windows $args | Out-GridView -outputmode Single -Title "Select folder to go to ..." | % {pushd $_ ; es.exe -inc-run-count "$_"}
}
Basically, it's the PowerShell version of QCD.cmd, but now a hybrid version: the list of folders to select from are shown in a "GUI". Press <Enter> on the folder you want to cd /pushd to. Like this:
2018-11-02 19_55_01-Windows PowerShell.png
2018-11-02 19_55_01-Windows PowerShell.png (42.1 KiB) Viewed 8125 times
Not documented (yet) - as I assumed it was only useful for myself - but I think you can figure out what this is doing :) Or just ask.
HerbM
Posts: 13
Joined: Tue Feb 27, 2018 3:18 am

Re: Search results: How to display seconds in date columns?

Post by HerbM »

I like it.

is it the "run count" switch set that isn't documented?

The GUI popup is slick though not my style, but it's given me a couple of ideas already for enhancing my own Set-GoLocation and my version of "cd" (Set-LocationFile).

They are separate right now but probably will be combined. Using this I can do some quite sophisticated enhancements.

BTW, Set-LocationFile lets you "cd to a file", takes pipeline input too, so I already use it with Where.exe and ES.

es SOMEPATTERN | select -first | cd # just works for file or directories
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: Search results: How to display seconds in date columns?

Post by NotNull »

HerbM wrote: Fri Nov 02, 2018 8:25 pm is it the "run count" switch set that isn't documented?
The "undocumented" referred to the script itself. Normally when I post here, there is some explanation of what it is, how it works, how to use, etc.

BTW, Set-LocationFile lets you "cd to a file", takes pipeline input too, so I already use it with Where.exe and ES.

Code: Select all

Function Go
{
es.exe -sort run-count !c:\windows $args | Out-GridView -outputmode Single -Title "Select folder to go  to ..." | gi | % {
	if ($_.PSIsContainer) {cd $_} else {cd $_.Directory}
	}
}
BTW: I also use a 'SpeedDial' command (sd) to cd to favorite directories: sd 3 to go to folder 3 on the list.
2018-11-03 23_43_45-Window.png
2018-11-03 23_43_45-Window.png (13.65 KiB) Viewed 8114 times
To try it, add this (simplified) code to your PowerShell profile:

Code: Select all

#======================================================================
#	SD (Speed Dial). CD to predefined folders with a "speeddial" number) 
#======================================================================


#$A =  (gc "$profile\..\speeddial.txt") -match '^[^ #]'
$A = @(`
#  Examples regular folders
   "c:\Windows\system32"   ,
   "c:\tools"              ,
   "C:\2install"           ,
   "C:\Program Files"      ,

#  Examples environment variables
   "$env:APPDATA"                   ,
   "$env:WINDIR\System32"           ,
   "$env:HOMEDRIVE$env:HOMEPATH"    ,

#  Examples shell folders
   [environment]::getfolderpath('Desktop')  ,
   [environment]::getfolderpath('Personal') ,
   [environment]::getfolderpath('System')

)


$SpeedDial = ( $A | % {
	$ExecutionContext.InvokeCommand.ExpandString($_)
})
$A = $null


#______________________________________________________________________
#
	function SD
#______________________________________________________________________
#
{
	if ($args[0] -is [int])
		{ cd (gi $SpeedDial[$args]) }
	else
		{ for($i = 0; $i -lt $SpeedDial.Count; $i++) {
				"[$i] $($SpeedDial[$i])"
			}
		}
}

es SOMEPATTERN | select -first | cd # just works for file or directories
How does that work for you? It's a bit like Google's "I feel lucky": go to the first entry that comes up ..
BTW: can be optimized to:
es -n 1 SOMEPATTERN | cd ....

option -n 1 : show max 1 result; that way you don't need the select -first. Shorter and faster.
Post Reply