Option: restore parent folder date after deleting (or moving from it) content

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Fla$her
Power Member
Power Member
Posts: 2321
Joined: 2020-01-18, 04:03 UTC

Option: restore parent folder date after deleting (or moving from it) content

Post by *Fla$her »

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
Last edited by Fla$her on 2024-04-17, 13:54 UTC, edited 2 times in total.
Overquoting is evil! πŸ‘Ž
User avatar
Dalai
Power Member
Power Member
Posts: 9398
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (SΓΌdthΓΌringen)

Re: Option: don't update the folder date when deleting (or moving from) content

Post by *Dalai »

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
Fla$her
Power Member
Power Member
Posts: 2321
Joined: 2020-01-18, 04:03 UTC

Re: Option: don't update the folder date when deleting (or moving from) content

Post by *Fla$her »

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! πŸ‘Ž
User avatar
petermad
Power Member
Power Member
Posts: 14810
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Option: don't update the folder date when deleting (or moving from) content

Post by *petermad »

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.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 2321
Joined: 2020-01-18, 04:03 UTC

Re: Option: restore parent folder date after deleting or moving content

Post by *Fla$her »

OK. Changed.
but should maybe also include adding files.
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.
Overquoting is evil! πŸ‘Ž
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1013
Joined: 2004-07-29, 11:00 UTC

Re: Option: restore parent folder date after deleting (or moving from it) content

Post by *ZoSTeR »

Β 
Full support.

I even wrote a script to prevent that at least for deleting files: post
Fla$her
Power Member
Power Member
Posts: 2321
Joined: 2020-01-18, 04:03 UTC

Re: Option: restore parent folder date after deleting (or moving from it) content

Post by *Fla$her »

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.
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
It's not recommended to create or modify items in a folder during a background operation.
Overquoting is evil! πŸ‘Ž
Post Reply