Option: restore parent folder date after deleting (or moving from it) content
Moderators: Hacker, petermad, Stefan2, white
Option: restore parent folder date after deleting (or moving from it) content
When using reverse date sorting (my default), deleting contents inside folders causes them to end up on top, although there is no benefit in this, on the contrary, it's confusing, harms the visual assessment and structuring of viewed or processed content (media and documents) and you often have to spend extra time checking useful changes (creating/modifying).
The suggested option will fix this problem. For example: RestoreDirDateAfterDeletingContent=0/1
The suggested option will fix this problem. For example: RestoreDirDateAfterDeletingContent=0/1
Last edited by Fla$her on 2024-04-17, 13:54 UTC, edited 2 times in total.
Overquoting is evil! π
Re: Option: don't update the folder date when deleting (or moving from) content
It's not TC which updates directory timestamps but Windows or the underlying file-system. As soon as directory contents are changed (file added, removed) the timestamp changes. Check with other file-managers, Explorer or CMD and you will see the same thing.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Re: Option: don't update the folder date when deleting (or moving from) content
It doesn't matter. We have the CopyDirTimeStamp and CopyAllTimes options that control the change of timestamps when copying, the same can be done for folders when deleting/moving from them, restoring the previous date, especially since TC has its own deletion mechanism when Win95Delete=0 and VistaDelete=0.
Overquoting is evil! π
Re: Option: don't update the folder date when deleting (or moving from) content
Hmm, it seems to me that the title of this topic should rather be: "Restore folder date after deleting (or moving) content".
It could be nice as an option, but should maybe also include adding files.
It could be nice as an option, but should maybe also include adding files.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Option: restore parent folder date after deleting or moving content
OK. Changed.
If the copy and move commands had such an option for a target folder, then it would make sense. But saving the date of any folder for any changes is no less a problem than I described.but should maybe also include adding files.
Overquoting is evil! π
Re: Option: restore parent folder date after deleting (or moving from it) content
I also did it on AutoIt, but not so much for the button as for reassigning Del and Shift + Del for the current delete command, restoring the date so far only in regular folders.
It's not recommended to create or modify items in a folder during a background operation.
DeleteWithSavingParentDirDate.au3
Code: Select all
;ββββββββββββββββββββββββββββββββββββ AU3 ββββββββββββββββββββββββββββββββββββ
; Purpose: Delete content with saving parent folder date
; Advice: Bind em_DeleteWithSavingParentDirDate to Delete and Shift+Delete
; Parameters: %S1:~,0
;βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
#NoTrayIcon
$hWnd = WinGetHandle('[ACTIVE]')
If DllCall('user32.dll','int','GetClassName','hwnd',$hWnd,'str','','int',4095)[2] <> 'TTOTAL_CMD' Then Exit
$sPanel = _GetInfo(1000)
Global $sCount = _GetInfo(1004 + $sPanel), $Type = 'Post'
If $sCount = 0 And _GetInfo(1008 + $sPanel) = 1 And _GetInfo(1006 + $sPanel) = 0 Then Exit
$Dir = StringRegExpReplace(ControlGetText($hWnd,'', _GetInfo(8 + $sPanel)),'\\[^\\]+$','')
$IsDir = FileExists($Dir & '\')
If $IsDir Then $Type = 'Send'
If StringLen($Dir) > 2 And $IsDir = 1 Then
If $sCount = 0 Then $sCount = 1
$MDate = FileGetTime($Dir, 0, 1)
Global $DSize = DirGetSize($Dir, 1), $iCount = $DSize[1] + $DSize[2], $NDate, $LDate, $lCount
$rCount = $iCount - $sCount
EndIf
DllCall('user32.dll','int',$Type & 'Message','hwnd',$hWnd,'uint',1075,'wparam',908,'lparam',0)
If IsDeclared('MDate') Then
While $rCount < $iCount
Sleep(500)
$DSize = DirGetSize($Dir, 1)
$iCount = $DSize[1] + $DSize[2]
If $iCount = $lCount Then ExitLoop
$lCount = $iCount
Wend
$NDate = $MDate
While $LDate <> $NDate
$LDate = $NDate
FileSetTime($Dir, $MDate)
Sleep(1000)
$NDate = FileGetTime($Dir, 0, 1)
Wend
If $MDate <> $NDate Then FileSetTime($Dir, $MDate)
Sleep(1000)
If $MDate <> FileGetTime($Dir, 0, 1) Then FileSetTime($Dir, $MDate)
EndIf
Func _GetInfo($i)
Return DllCall('user32.dll','handle','SendMessage','hwnd',$hWnd,'uint',1074,'wparam',$i,'lparam',0)[0]
EndFunc
Overquoting is evil! π
Re: Option: restore parent folder date after deleting (or moving from it) content
Just a suggestion, add a local configuration file for a file system components. For example, to avoid apply it everywhere, instead add file `.wincmd.ini` into a directory you want to alter the behavior:
Code: Select all
[Configuration]
RestoreDirDateAfterDeletingContent=1
RestoreDirDateAfterDeletingContent_RecurseSubdirs=1
RestoreDirDateAfterDeletingContent_DirGlobbing="MyDir*"
Re: Option: restore parent folder date after deleting (or moving from it) content
Do you want the behavior when selecting from branch mode and search results to be different from the normal folder mode? Why is it necessary?andry81 wrote: 2024-05-13, 11:58 UTC For example, to avoid apply it everywhere,Code: Select all
RestoreDirDateAfterDeletingContent_RecurseSubdirs=1
It's better if one option will regulate all parent dirs in which the disappearance occurs.
Overquoting is evil! π
Re: Option: restore parent folder date after deleting (or moving from it) content
Just suggest a local config file to override a global config.Fla$her wrote: 2024-05-13, 16:44 UTCDo you want the behavior when selecting from branch mode and search results to be different from the normal folder mode? Why is it necessary?andry81 wrote: 2024-05-13, 11:58 UTC For example, to avoid apply it everywhere,Code: Select all
RestoreDirDateAfterDeletingContent_RecurseSubdirs=1
It's better if one option will regulate all parent dirs in which the disappearance occurs.
Re: Option: restore parent folder date after deleting (or moving from it) content
I don't understand, are you talking about the RedirectSection key? How does this relate to my question?
Overquoting is evil! π
Re: Option: restore parent folder date after deleting (or moving from it) content
Local config enables it for a specific directory instead to add it to the global config, where it would be enabled for all directories, which is definitely is a bad solution.
Re: Option: restore parent folder date after deleting (or moving from it) content
I asked, "Why is this necessary?" in relation to _RecurseSubdirs, not _DirGlobbing.
Overquoting is evil! π
Re: Option: restore parent folder date after deleting (or moving from it) content
Because the recursivity or nesting is a part of each directory. You can use multiple levels, for example: Years/Months/DaysFla$her wrote: 2024-05-15, 06:33 UTC I asked, "Why is this necessary?" in relation to _RecurseSubdirs, not _DirGlobbing.
So you have to restore the whole directories path.
Or you mean why not use recursion by default? I think it should be optional and does apply to the directory where the local config file is placed.
Re: Option: restore parent folder date after deleting (or moving from it) content
Once again: pseudo-recursion during deletion is possible only for files selected in DirBranch mode. That's why I asked about your desire to separate the behavior (given the additional key) of 3 modes and pointed out that this separation doesn't look right, safe and expected for many users, i.e. I wouldn't approve of this key with _RecurseSubdirs.
The real recursion concerns considering the entire depth of folders, and since deletion doesn't have file filtering, then there can be no recursion as such.
The real recursion concerns considering the entire depth of folders, and since deletion doesn't have file filtering, then there can be no recursion as such.
Overquoting is evil! π