In TC, how to copy a folder (with files and folders) and keep the creation date ?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Kristof
Junior Member
Junior Member
Posts: 15
Joined: 2023-02-01, 18:38 UTC

In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *Kristof »

Hi, in TC, how to copy a folder (with files and folders) and keep the creation date ?
I am annoyed because Total Commander is currently not preserving date/time of files and folders even though the option "Copy date/time of directories" is set to On (Image: https://i.imgur.com/PMTslXI.png) :
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *petermad »

The Created date is the date the file is first put in a folder. It is the Modified date that is the original date which TC (and Explorer) displays and preserves.

You can make TC also copy creation date/time and last access date/time by putting the CopyAllTimes=1 parameter in the [Configuration] section of your wincmd.ini file:
Help wrote:CopyAllTimes=0 0: Copy just the last modified date/time
1: Also copy creation date/time and last access date/time

You can make TC copy the date of the folders via menu: "Configuration" -> "Options..." -> "Copy/Delete" -> "General Copy+Delete options" -> "Copy date/time of directories"

But NOTICE - on NTFS formatted disks the date of a folder is constantly changed by the system, when the content of the folder is changed.
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
Kristof
Junior Member
Junior Member
Posts: 15
Joined: 2023-02-01, 18:38 UTC

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *Kristof »

I have added CopyAllTimes=1 to wincmd.ini file : Image: https://i.imgur.com/OcDdP9N.png

But even after restarting Windows, when I copy with TC, the creation date/time & the access date/time of the copied files are still modified to the current copy date/time. I have exactly the same behavior as when CopyAllTimes=0
Can you check if it really works for you ?

I seriously believe it is not working because I have even tried this by installing a trial version of TC on different PC and I have added CopyAllTimes=1 to the .ini. -> Copied files also have the creation date/time & the access date/time modified to the current copy date/time.
User avatar
Dalai
Power Member
Power Member
Posts: 9949
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *Dalai »

2Kristof
Have you modified the correct wincmd.ini, e.g. by using "Change settings files directly" in TC's main menu? Is there only a single CopyAllTimes entry in your wincmd.ini?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *petermad »

2Kristof
Can you check if it really works for you ?
Just copied my wincmd.ini file to c:\test - all dates were copied - see: https://tcmd.madsenworld.dk/CopyAllTimes1test.png

Here is the same test with CopyAllTimes=0 https://tcmd.madsenworld.dk/CopyAllTimes0test.png

Tested on Windows 7 and 10 with TC 11.00b8

You don't have to restart Windows after editing wincmd.ini, you just have to restart TC - the best thing is to save the edited file AFTER you close TC, and the restart TC - then there is no risk that the change get overwritten when you close TC.

Make sure you edit the correct wincmd.ini - you can see the location at menu: "Help" -> "About Total Commander". or you can edit the ini files via menu: "Configuration" -> "Change Settings Files Directly" - but remember to keep Notepad open, close TC and then save the file in Notepad.
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
Kristof
Junior Member
Junior Member
Posts: 15
Joined: 2023-02-01, 18:38 UTC

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *Kristof »

I have edited the .ini when TC was fully closed each time. I understand restarting Windows is not necessary, but as it was not working like what your described, I wanted to take a belt and braces approach.
I have also checked the .ini thanks the TC about pop-up: it is the correct one I was editing.
I am even edited the .ini from Configuration | 'Change Settings Files Directly'. I have also checked each time CopyAllTimes=1 is still present in .ini after restarting and closing TC.

I have tried again several times after looking at your 2nd post, and despite CopyAllTimes=1 in the .ini, I still have the creation & access date being modified when copying a file. Are you also using NTFS as file system ? I have Windows 11 fully up to date and NTFS.

I have used TC v10.52 final each time. As you are using TC v11.00b8, I have downloaded the latest beta in Windows Sandbox to try if it works like you. But even when CopyAllTimes=1 is added to the .ini, the creation and access date/time are still being modified to current date/time of copy 😓.
https://i.imgur.com/q9WOXV3.png (I have here copied the TC installer .exe and .ini to Music folder to test, but date/times were still modified with the date/time of copy)
User avatar
petermad
Power Member
Power Member
Posts: 16009
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *petermad »

but date/times were still modified with the date/time of copy)
Could you please, show the Properties (Alt+Enter) dialogs for the original file and the copied file - like on my screenshot https://tcmd.madsenworld.dk/CopyAllTimes1test.png
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
User avatar
Dalai
Power Member
Power Member
Posts: 9949
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *Dalai »

2Kristof
Where do you copy the files to? A local directory or a virtual directory/folder like \\Documents or \\Desktop? And how do you copy the files, via F5, Drag'n'Drop or Ctrl+C/Ctrl+V?

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
frank.j.a
Junior Member
Junior Member
Posts: 5
Joined: 2005-09-06, 09:38 UTC

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *frank.j.a »

Jumping in... Having exact same problem - on one win10 pc - but works perfect (keeps creation date) on other win 10 pc. Compared ini files / modified - no change.

Checked filesystem target on both machines is NTFS.

Problem seems to be the file source. Copying a file locally on pc works, but copying from attached cameras folder - creation date changes....

So - the source is the key. Verified same camera causes same problem on both machines. Strange..... What to do??? Canon Powershot SX200 BYTW..

BR Frank
frank.j.a
Junior Member
Junior Member
Posts: 5
Joined: 2005-09-06, 09:38 UTC

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *frank.j.a »

...seems one has to use the 'import' of pictures to local disk. This keeps original dates, and then files can be copied from local disk retaining the dates...

The problem is camera specific. Did same operation on my Canon EOS 550D - here copying with TC works fine.

Really strange....

BR Frank
User avatar
beb
Power Member
Power Member
Posts: 580
Joined: 2009-09-20, 08:03 UTC
Location: Odesa, Ukraine

Re: In TC, how to copy a folder (with files and folders) and keep the creation date ?

Post by *beb »

FYI, to quickly set folder timestamps after their content I use a PowerShell script, a user command, and a button like these:

button bar:

Code: Select all

TOTALCMD#BAR#DATA
em_redate_folders_by_content

WCMICON2.DLL,80
PowerShell: Redate folders by content recursively

0
10026
user command (usercmd.ini):

Code: Select all

[em_redate_folders_by_content]
cmd=pwsh -c "%commander_path%\Plugins\app\Date\PowerShell\redateFolders_byContent.ps1"
PowerShell script (redateFolders_byContent.ps1):

Code: Select all

$timer = [system.diagnostics.stopwatch]::StartNew()
Get-ChildItem -force -recurse -directory|foreach {
Get-ChildItem $_ -force -recurse -file|Measure -property LastWriteTime -maximum|Tee -var max|out-null # latest
(Get-Item $_.FullName).LastWriteTime = Get-Date $max.Maximum # latest
"{0:yyyy}-{0:MM}-{0:dd} {0:hh}:{0:mm}:{0:ss} {1}" -f $_.LastWriteTime,$_
}
$timer.Stop();"";"Timer : {0:mm}:{0:ss}.{0:fff}" -f ($timer.Elapsed);sleep -s 3
NB
The above code sets a folder's [Modification a.k.a. Write a.k.a. LastWriteTime*] date/time after the latest file inside.
To do the same after the earliest file inside, just change '-maximum' and '.Maximum' properties to '-minimum' and '.Minimum' ones.
A variable name '$max' doesn't actually matter, though you can also change it there to '$min' just respecting harmony.

* Understanding the Date/Time namings:

Code: Select all

PowerShell          Windows          Total Commander             
.LastWriteTime      Modification     tc.writedate,   tc.writetime
.CreationTime       Creation         tc.creationdate,tc.creationtime
.LastAccessTime     Access           tc.accessdate,  tc.accesstime
In Total Commander it is LastWriteTime/Modification/Write Date/Time ([=tc.writedate.D-M-Y h:m] or so) that we see in the 'Date' column by default.

'pwsh' in user command implies cross-platform PowerShell (v7+)** is being utilized here.

Edit

** It took me a while to make it work in Windows PowerShell (v5.1) as well. Explicitly putting .FullName property to the current pipeline item when getting its .LastWriteTime property value appeared to be enough to do the trick, so I changed the script to fit both v7 and v5.1 simultaneously.

user command for Windows PowerShell (v5.1) would be as follows (just to change the name of the executable from 'pwsh' to 'powershell'):

Code: Select all

[em_redate_folders_by_content]
cmd=powershell -c "%commander_path%\Plugins\app\Date\PowerShell\redateFolders_byContent.ps1"
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Post Reply