Select all files with same date?

English support forum

Moderators: Stefan2, white, sheep, Hacker

f0ff886f
Junior Member
Junior Member
Posts: 4
Joined: 2019-02-03, 14:15 UTC

Select all files with same date?

Post by *f0ff886f » 2019-02-17, 13:13 UTC

Is it possible to select all files with the same date (not time)?

User avatar
petermad
Power Member
Power Member
Posts: 8341
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Select all files with same date?

Post by *petermad » 2019-02-17, 18:01 UTC

The easiest way would be to sort files by date, mark the first file of the given date and then Shift-click on the last file of the given date
Last edited by petermad on 2019-02-18, 08:32 UTC, edited 1 time in total.
License #524 (1994)
Danish Total Commander Translator
TC 9.22a 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit, 'Everything' 1.4.1.935 (x64) and TC 3.0b3 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

vdijken
Junior Member
Junior Member
Posts: 62
Joined: 2016-07-30, 14:07 UTC
Location: The Netherlands

Re: Select all files with same date?

Post by *vdijken » 2019-02-17, 20:27 UTC

Search for files *.* with Alt+F7 and option "advanced" "date between"; fill in the same date.

User avatar
petermad
Power Member
Power Member
Posts: 8341
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: Select all files with same date?

Post by *petermad » 2019-02-18, 08:35 UTC

Search for files *.* with Alt+F7 and option "advanced" "date between"; fill in the same date.
And then: "Feed to listbox" -> Mark all files
License #524 (1994)
Danish Total Commander Translator
TC 9.22a 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit, 'Everything' 1.4.1.935 (x64) and TC 3.0b3 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

User avatar
Stefan2
Power Member
Power Member
Posts: 2437
Joined: 2007-09-13, 22:20 UTC
Location: Europa

VBScript: Select all files with same date

Post by *Stefan2 » 2019-02-18, 12:17 UTC

f0ff886f wrote:
2019-02-17, 13:13 UTC
Is it possible to select all files with the same date (not time)?
You can utilize a external script, TC will support you with parameters to send arguments to such scripts.

Here is a VBScript to do what you want (it is a bit slow, better we would rewrite this in AutoHotkey)


EDIT: sorry, I forgot, this may work for German date (18.02.2019) only.
If from interests, I have to adjust the code to work with 02/18/2019 too :D
But I just take the first ten signs, so it may work for English language setting too just out of the box.




VBScript for TotalCommander
Select all files with same DATE as current selected file.

Save the Code block as "SelectSameDate.vbs" in TC folder and create a button.
Next select one file, then execute the button
You may want to use menu "SHOW > Only Selected Files"
( use "Show > All Files" to see all files again )


TC -Button:

Code: Select all

'English/Deutsch/UserCmd.ini : 	Entry / Eintrag
Command/Kommando/cmd: 		"%Commander_Path%\SelectSameDate.vbs"
Parameters/Parameter/param: 	%P%N
Start path/Startpfad/path: 
Icon file/Icon/button: 		C:\windows\System32\WScript.exe
Tooltip/Tooltip/menu : 		Select files with same DATE as current selected file



SelectSameDate.vbs

Code: Select all

'// VBScript for TotalCommander, Stefan, v00.1, 2019-Feb-18
'// Select all files with same DATE as current selected file.
'
' Found at https://ghisler.ch/board/viewtopic.php?p=351709#p351709
'
'// Save THE CODE as "SelectSameDate.vbs" in TC folder and create a button.
'// Next select one file, then execute the button
'// You may want to use menu "SHOW > Only Selected Files"
'// ( use "Show > All Files" to see all files again )
'
'
'// TC -Button:
'English/Deutsch/UserCmd.ini : 	Entry / Eintrag
'Command/Kommando/cmd: 			"%Commander_Path%\SelectSameDate.vbs"
'Parameters/Parameter/param: 	%P%N
'Start path/Startpfad/path: 
'Icon file/Icon/button: 		C:\windows\System32\WScript.exe
'Tooltip/Tooltip/menu : 		Select files with same DATE as current selected file

'//--------------------------------------------------------
'//--------------------------------------------------------
'//-------------------------------------------------------- // THE CODE 'SelectSameDate.vbs
'
Set FSO = CreateObject("Scripting.FileSystemObject")
strCurrentFile = Wscript.arguments.Item(0) '//%P%N
'
If(strCurrentFile ="") Then
	MsgBox "No Selection, Script ends here."
	WScript.Quit
End If
'
Set oItem     = FSO.GetFile(strCurrentFile)
	sName     = FSO.GetFileName(oItem)
	sBase     = FSO.GetBaseName(oItem)
	sExte     = FSO.GetExtensionName(oItem)
	sPath     = oItem.ParentFolder
	sCreated  = oItem.DateCreated
	sAccessed = oItem.DateLastAccessed
	sModified = oItem.DateLastModified
	sDATEonly = left(sModified,10)

	Set oFolder = FSO.GetFolder(sPath)
	Set colFiles = oFolder.Files
	For Each oFile in colFiles
		If(left(oFile.DateLastModified,10) = sDATEonly) Then
			sOUT = sOUT & oFile.Name & vbCRLF
		End If
	Next
'
'MsgBox sOUT
SetClipboard sOUT
'
' cm_LoadSelectionFromClip=2033;Read file selection from clipboard
SendMessage "Total Commander",1075,2033,0
'
'
'//--------------------------------------------------------
'//-------------------------------------------------------- HELPER function
'//--------------------------------------------------------
'VBScript SendMessage
'http://demon.tw/copy-paste/vbs-sendmessage.html
'BY Coo_boi
Function SendMessage(lpWinTitle,wMsg,wParam,lParam)
	Dim WordApp,ShApp,colTask,oTask
	Set WordApp=CreateObject("Word.Application")
	Set colTask=wordapp.Tasks
	SendMessage=False
	For Each oTask In colTask
		If oTask.Visible And InStr(oTask.Name,lpWinTitle) Then
			oTask.SendWindowMessage wMsg,wParam,lParam
			SendMessage=True
			Exit For 
		End If
	Next
	WordApp.Quit
	Set WordApp=Nothing
End Function
'//--------------------------------------------------------
Function SetClipboard(stringToSet)
On Error Resume Next
    Dim objIE : Set objIE = CreateObject("InternetExplorer.Application")
    
      objIE.Visible = True
	  Do While objIE.busy : WScript.Sleep 100 : Loop
    
    objIE.Navigate("about:blank")
    objIE.document.parentwindow.clipboardData.SetData "text", stringToSet
    objIE.Quit
End Function
'//--------------------------------------------------------
'//END




 

User avatar
Hacker
Moderator
Moderator
Posts: 11195
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Select all files with same date?

Post by *Hacker » 2019-02-18, 19:54 UTC

Stefan2,
Great idea! I have created an AHK version:

Code: Select all

FileGetTime, Date, %1%
FormatTime, Date, %Date%, yyyyMMdd
Loop, Files, *.*
{
	FormatTime, DateChecked, %A_LoopFileTimeModified%, yyyyMMdd
	If (DateChecked = Date)
		SameDateFileList .= A_LoopFileName . "`n"
}

If (SameDateFileList)
{
	ClipboardBak = %ClipboardAll%
	Clipboard := Substr(SameDateFileList, 1, StrLen(SameDateFileList) - 1)
	PostMessage, 1075, 2033, , , ahk_class TTOTAL_CMD
	Sleep, 1000
	Clipboard = %ClipboardBak%
}
Or a shorter, less readable version:

Code: Select all

FileGetTime, Date, %1%
FormatTime, Date, %Date%, yyyyMMdd
Loop, Files, *.*
	SameDateFileList .= Substr(A_LoopFileTimeModified, 1, 8) = Date ? A_LoopFileName . "`n" : ""

If (SameDateFileList)
{
	ClipboardBak = %ClipboardAll%
	Clipboard := Substr(SameDateFileList, 1, StrLen(SameDateFileList) - 1)
	PostMessage, 1075, 2033, , , ahk_class TTOTAL_CMD
	Sleep, 1000
	Clipboard = %ClipboardBak%
}
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.

User avatar
Stefan2
Power Member
Power Member
Posts: 2437
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Select all files with same date?

Post by *Stefan2 » 2019-02-19, 09:02 UTC

Thank you very much, Roman.
Your script works fine with German date dd.mm.yyyy

Bonus points for working on just today date, if you forget to add the parameter on the button ;-)






 

User avatar
Hacker
Moderator
Moderator
Posts: 11195
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Select all files with same date?

Post by *Hacker » 2019-02-19, 10:01 UTC

Stefan2,
Yes, that's a side effect of leaving out the parameter check. :D

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.

User avatar
tuska
Power Member
Power Member
Posts: 1468
Joined: 2007-05-21, 12:17 UTC

Re: Select all files with same date?

Post by *tuska » 2019-02-20, 10:48 UTC

Hi,
I am also very interested in the AHK script.
Unfortunately, I rarely (twice) managed to color files accordingly.
The next time I tried it, I couldn't color the files anymore.

Does anyone have any idea why?

Code: Select all

FileGetTime, Date, %1%
FormatTime, Date, %Date%, dd.mm.yyyy
Loop, Files, *.*
	SameDateFileList .= Substr(A_LoopFileTimeModified, 1, 8) = Date ? A_LoopFileName . "`n" : ""

If (SameDateFileList)
{
	ClipboardBak = %ClipboardAll%
	Clipboard := Substr(SameDateFileList, 1, StrLen(SameDateFileList) - 1)
	PostMessage, 1075, 2033, , , ahk_class TTOTAL_CMD
	Sleep, 1000
	Clipboard = %ClipboardBak%
}

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Tools\AutoHotkey\Dateien-mit-gleichem-DATUM-markieren.ahk
%P%N
%COMMANDER_PATH%\Tools\AutoHotkey\AutoHotkey.exe,1
Dateien mit gleichem DATUM markieren (Cursor auf einer Datei positionieren)


-1

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Tools\AutoHotkey\Dateien-mit-gleichem-DATUM-markieren.ahk

%COMMANDER_PATH%\Tools\AutoHotkey\AutoHotkey.exe,1
Dateien mit heutigem DATUM markieren


-1
- Autohotkey: Latest Version
- cm_srclong
- no View Mode and Auto Switch Mode
- no other colouring

A test with a TC_clean.ini - 9.21a (x64) - 64 bit was also negative.
I am at a loss :?

Regards
Karl

EDIT: "Start path" in button: %COMMANDER_PATH%\Tools\AutoHotkey\ REMOVED!
Last edited by tuska on 2019-02-20, 12:51 UTC, edited 1 time in total.

User avatar
Stefan2
Power Member
Power Member
Posts: 2437
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Select all files with same date?

Post by *Stefan2 » 2019-02-20, 11:38 UTC

Hi Karl,
tuska wrote:
2019-02-20, 10:48 UTC
...
Unfortunately, I rarely (twice) managed to color files accordingly.
>> ? <<
The next time I tried it, I couldn't color the files anymore.
...

What did you do in between, in Step 2?

1.) You execute the script, files are selected.
2.) you did <<<<< ? .... no file is selected anymore ?
3.) "The next time I tried it, I couldn't color the files anymore."




I had modified Romans' script

Code: Select all

	PostMessage, 1075, 2033, , , ahk_class TTOTAL_CMD
		;Menu "SHOW > Only Selected Files" > cm_ShowOnlySelected=2023;Hide files which aren't selected
		PostMessage, 1075, 2023, , , ahk_class TTOTAL_CMD
	Sleep, 1000
	Clipboard = %ClipboardBak%
 

and tested it in my Temp-folder, and it works any time.

I have now removed that change, and the script works any time , even now without refreshing the list view.
- select a file
- execute the script
- files are highlighted
- click elsewhere
- execute the script
- files are highlighted
- .....



don't know what happens :roll:
 

User avatar
tuska
Power Member
Power Member
Posts: 1468
Joined: 2007-05-21, 12:17 UTC

Re: Select all files with same date?

Post by *tuska » 2019-02-20, 12:00 UTC

Stefan2 wrote:
2019-02-20, 11:38 UTC
Hi Karl,
tuska wrote:
2019-02-20, 10:48 UTC
...
Unfortunately, I rarely (twice) managed to color files accordingly.
>> ? <<
The next time I tried it, I couldn't color the files anymore.
...
What did you do in between, in Step 2?

1.) You execute the script, files are selected.
2.) you did <<<<< ? .... no file is selected anymore ?
3.) "The next time I tried it, I couldn't color the files anymore."
Hi Stefan,
I did "Unselect All Ctrl Num -" and tried to color other files, but there was no more coloring.
During about 20 attempts, files were colored twice. Currently there is no more coloring.
I don't understand that. :?

Could you maybe use "my" script to test, please?
(I mean the Hacker's script that I'm using and announced above).

User avatar
Stefan2
Power Member
Power Member
Posts: 2437
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Select all files with same date?

Post by *Stefan2 » 2019-02-20, 12:22 UTC

Hi Karl,

you have modified Romans' script yourself :idea:
tuska wrote:
2019-02-20, 10:48 UTC

Code: Select all

FileGetTime, Date, %1%
FormatTime, Date, %Date%, dd.mm.yyyy
Loop, Files, *.*
}
My statement "Your script works fine with German date dd.mm.yyyy"
means "Your script works fine on PCs with German date dd.mm.yyyy"
and don't mean to modify the script to work on German date format.
Just leave it as Roman posted it. (I don't know right now what that really would change, but... . Probably because of the Substr(xx, 1, 8 ) command)



HTH? :D

User avatar
tuska
Power Member
Power Member
Posts: 1468
Joined: 2007-05-21, 12:17 UTC

Re: Select all files with same date?

Post by *tuska » 2019-02-20, 12:38 UTC

Stefan2 wrote:
2019-02-20, 12:22 UTC
Hi Karl,
you have modified Romans' script yourself :idea:
Hi Stefan,
Yes, that was it! :oops:

Now everything works as desired ("Start path:" in button has to be left blank(!)).
Thank you so much for looking into that.

Regards,
Karl

f0ff886f
Junior Member
Junior Member
Posts: 4
Joined: 2019-02-03, 14:15 UTC

Re: Select all files with same date?

Post by *f0ff886f » 2019-02-20, 14:14 UTC

Thank you all for the awesome scripts! I will use the AHK version, this is really amazing support. Many many thanks!

User avatar
tuska
Power Member
Power Member
Posts: 1468
Joined: 2007-05-21, 12:17 UTC

Re: Select all files with same date?

Post by *tuska » 2019-02-20, 18:21 UTC

I have another request:
With this script (modified by Stefan2), after calling and receiving the filtered files from today, is it possible to
remove the marker? In this case, the red marking disturbs me and the only thing that will be shown anyway is the
files from today.

Code: Select all

FileGetTime, Date, %1%
FormatTime, Date, %Date%, yyyyMMdd
Loop, Files, *.*
	SameDateFileList .= Substr(A_LoopFileTimeModified, 1, 8) = Date ? A_LoopFileName . "`n" : ""

If (SameDateFileList)
{
	ClipboardBak = %ClipboardAll%
	Clipboard := Substr(SameDateFileList, 1, StrLen(SameDateFileList) - 1)
	PostMessage, 1075, 2033, , , ahk_class TTOTAL_CMD
	;Menu "SHOW > Only Selected Files" > cm_ShowOnlySelected=2023;Hide files which aren't selected
	PostMessage, 1075, 2023, , , ahk_class TTOTAL_CMD
	Sleep, 1000
	Clipboard = %ClipboardBak%
}
I tried the following command:

Code: Select all

em_Dateien-mit-heutigem-DATUM-markieren_und-nur-diese-anzeigen,cm_ExchangeSelBoth
but without success.

Post Reply