Page 1 of 2

Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-09, 15:27 UTC
by jnauth
Hi Christian,
was wondering if this Feature isn´t implemented in a more simplified way yet.

Sometimes I just want to change Timestamps of some Folders with one touch. So the F5 Copy Option doesn´t offer something like "Copy Timestamp".

I help myself at the moment with "Sync Directory function" --> then unmark all Files in the Comarison Windows --> and then Right Click and chosse the Option "Copy Timestamp", which will synchronize the Timestamp of all Folders after pressing "Synchronize".

But in my eyes this task is too time demanding and it would be a lot easier, if the "Copy Timestamp" option is offered after pressing F5 in the Options Dialog Box.

And if the Option is chossen, than only the individual Timestamps of all marked objects will be copied (in case only Directories are marked, then only for those directories. But the Feature could alos copy Timestamps as well for marked files)

Maybe such an simplified "Timestamp Copy"-Feature would enhance your great tool some more. :D

Best regards and have a nice Sunday,
Joerg

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-09, 16:39 UTC
by Dalai
Copying directory timestamps already exists: Configuration > Options > Copy/Delete > Copy date/time of directories.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-09, 19:39 UTC
by jnauth
This only works, when Destination Folder is NEWLY created and doesn´t exist.

Once destination folder is already present and has a date, this folder date will not be changed when copying again. The date of destination will remain on the date when it was created. But for Sync reason the Date should be then the same as Source Folder.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-09, 20:21 UTC
by Dalai
jnauth wrote: 2025-02-09, 19:39 UTCThis only works, when Destination Folder is NEWLY created and doesn´t exist.
True. But your OP didn't make it clear (to me) that it's about existing directories.

I know it's a suggestion to implement a feature in TC but IIRC there can be scripts found in this forum that are able to copy timestamps of selected directories. Maybe you can make use of one of them if you have (urgent) need for such a feature.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-11, 19:18 UTC
by jnauth
Hello Dalai,
Use Case is very simple. After synchronizing directories with file, the directory timestamp of source and target should be same, so I know that they have a synced status. If timestamp is diefferent, if have to check manually the directory of source and target about the files in there.

So the timestamp of the directory can be an indicator for "Synced status". In practical terms the Use case described in another way. After downloading three docuements, I copy them first in my main document folder "d:\Magazines\Unread"".

Right after I move them from the Downloadfolder to my Backuptdrive "S:\Magazines\Unread".
The same thing I can do as well with Folder Sync of Total Commander and syncing the Source "d:\Magazines" and the Target "S:\Magazines"

Now the but:
After copying or syncing the "Unread" folder of "d:\Magazines" with the existing "s:\Magazines", all the subfolders incl. the new files will be copied and synchronized. But the Timestamps of the Subfolders of Source and Target are different, because timestamps of existing folders in Target will not changed ebevn when new files are copied in there.

That´s why a manual Timestamp Copy of Folders would make sense.

Anyway, I created now the following Robocopy command which would do that and what I can add in the Buttonbar of TC:
robocopy /e /timfix /dcopy:t /copy:t d:\Magazines S:\Magazines

This copies all timestamps of directories and subdiresctories

But I am still struggling to put that in the Buttonbar commandline, that it is executed correctly. Left pane is on "d:\Magazines", right pane on "S:\Magazines".

But if I create the Buttonbar Command
robocopy /e /timfix /dcopy:at /copy:t %P %T
the two paramters %P (Source Path) and %T (target Path) are not handed over to the robocopy Commandstring.

Tried it as well in the parameter field and alos with quotation marks before and after.
Finallly I alos tried a simplified command like "cd %P" to see if TC would execute this via Buttonbar. But also there the %P is not handed over to the cd command.

What am I doing wrong - where is the Syntax bug for handing over the Source and Target Path to the command?

Any help welcome. If correct Syntax will be found, I can create a Buttonbar command, where I can quickly synchrionize the Timestamp of Source and Target Folder incl. Subfolders. And that´s what I need.

So I am looking forward for your help here to implement that Buttonbar command correctly.

Regards and thx in advance,
jnauth

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-11, 20:46 UTC
by Dalai
Placeholders only work in the Parameters field as is explained in the TC help.

This button should work (though I haven't tested it):

Code: Select all

TOTALCMD#BAR#DATA
%SystemRoot%\system32\robocopy.exe
/e /timfix /copy:t /dcopy:t "%P" "%T"
shell32.dll



-1
If it doesn't work, put a question mark at the beginning of the Parameters field so that TC shows the expanded parameters when clicking the button. Copy them and test the full command on a CMD to see what's wrong. Not sure if Robocopy supports trailing backslashes.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-12, 00:15 UTC
by Fla$her
Dalai wrote: 2025-02-11, 20:46 UTC Not sure if Robocopy supports trailing backslashes.
No.

Code: Select all

TOTALCMD#BAR#DATA
robocopy.exe /e /timfix /copy:t /dcopy:t /ndl /nfl /njh /njs
"%P:~,-1" "%T:~,-1"
wcmicon2.dll,7
Migrate timestamps from the source to the target directory

1
If it's necessary to distinguish between the left and right panels, then put %X before "%P.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-12, 07:18 UTC
by sa16
It is possible and so:

Code: Select all

TOTALCMD#BAR#DATA
robocopy.exe
/e /timfix /copy:t /dcopy:t /xl "%P " "%T "
shell32.dll


1

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-12, 19:24 UTC
by jnauth
Hi Dalai, Fla$her and sa16,
first of all thank you for your responses. I tried all of your suggestions and the solutions of Fla$her and sa16 worked out right away, and Dalais´s first not. But with adding a space after ""%P" and "%T" helped also and then it worked as well

My final working solution is:
robocopy.exe
? /e /timfix /copy:t /dcopy:t "%P " "%T "

The leading? is very helpful because then I can still stop the execution in case I don´t want to execute the command (very helpful if selected Source and Folder are mixed up --> without break out possibility then the Target would sync right away the timestamps to the Source what can cau chaos)

Anyway, the following questions remain open - and I would like to answer them so this knowledge can be preserved:
----------------
1)
Why is a Space needed behind %P and %T?
The whole command string has already spaces and the TC docu doesn´t say anything about it that spaces before or after might be needed
And all the more I am wondering why the is a space needed at the end of the parameter string after the %T
(Remark: Without the space behind the %T the command is also not working any more)
----------------
2)
What is the /xl parameter for in sa16 suggestion?
Can´t find this Robocopy parameter anywhere explained nor documented
----------------
3)
In the Buttonbar Commandline, it it allowed to add paramter of the executed program. Just the TC internal parameters can´t be added there and have to be added separately in the parameter line. So out of curiosity I tried the Buttonbar Command like this

TOTALCMD#BAR#DATA
robocopy.exe/e /timfix /copy:t /dcopy:t
" %P" " %T"
--> But it looks like that TC can´t handle parameters mixed in the command line and the parameter line. Am just wondering why because I would expect that TC ist just merging the strings. But in sa16 suggestions his mixed parameters can be handled of TC
----------------
4)
As I wrote sa16 solutions works. But the syntax is more or less a bit of riddle.
- What are the parameters /ndl /nfl /njh /njs for and why are the needed?
(without them his solution also doesn´t work any more)
- What is this pecial parametr syntax "%P:~,-1" "%T:~,-1" in the parameter line? I can´t find anywhere a docu about the :~,-1 behind
the %P and %T and what they are good for.
----------------
Would be great if you can help me in finding answers to the 4 questions above.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-12, 20:09 UTC
by Dalai
jnauth wrote: 2025-02-12, 19:24 UTCWhy is a Space needed behind %P and %T?
%P and %T have a trailing backslash. A backslash can be used to make the following character a literal character, removing its special meaning. Since the following character is the trailing quote, the resulting command won't have a trailing quote and will not work. Fla$her's solution is to remove the trailing backslash, thus making the command work as expected.
What is the /xl parameter for in sa16 suggestion?
It is in the Robocopy documentation which can be called by

Code: Select all

robocopy /?
. It does exclude links, most likely meaning junctions and symlinks (maybe only the latter).
[EDIT] I remembered incorrectly. See sa16's response below. [/EDIT]
But it looks like that TC can´t handle parameters mixed in the command line and the parameter line.
It can work with parameters in both fields. The Parameter's value is appended to the ones in the Command field. But since you used leading spaces within the quoted %P and %T and didn't add trailing spaces, the command won't work properly.
- What are the parameters /ndl /nfl /njh /njs for and why are the needed?
Also documented in Robocopy documentation. For the sake of completeness:
NDL = No Directory List
NFL = No File List
NJH = No Job Header
NJS = No Job Summary
(without them his solution also doesn´t work any more)
I doubt that. They just control what robocopy prints on the screen.
- What is this pecial parametr syntax "%P:~,-1" "%T:~,-1" in the parameter line? I can´t find anywhere a docu about the :~,-1 behind the %P and %T and what they are good for.
See above. These substrings are documented in TC's help. The syntax is more or less the same as in CMD's environment variables.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-12, 20:23 UTC
by sa16
2jnauth
What is the /xl parameter
/XL Excludes files and directories tagged as “Lonely”.
lonely The directory exists in the source but not the destination (a Lonely directory). The directory is skipped; to process this directory, omit /XL.
Why is a Space needed behind %P and %T?
For the case when the path contains spaces (alternative solution instead of :~,-1).

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-13, 00:19 UTC
by Fla$her
jnauth wrote: 2025-02-12, 19:24 UTC As I wrote sa16 solutions works. But the syntax is more or less a bit of riddle.
- What are the parameters /ndl /nfl /njh /njs for and why are the needed?
(without them his solution also doesn´t work any more)
The combination /ndl /nfl /njh /njs is my solution, not sa16. Suppressing the output due to it significantly speeds up the process.
And as correctly noted, removing it will not lead to a stop, but will lead to a slowdown.
sa16 wrote: 2025-02-12, 20:23 UTC alternative solution instead of :~,-1
Also an alternative is an additional backslash ("%P\"). But both alternatives are more like tricks (bugs that help) than the right solution.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-14, 17:38 UTC
by jnauth
Hi Dalai, Fla$her and sa16,
thank all you very much for your help and your explanantions.

It also showed me that I had to update my generated Robocopy Parameter List, which was too old (I created a PDF long time ago, which was of course not up to date any more :D
And I intensified my reading of the TC Help, which I didn´t do too much in the past but where everything is well documented.

Have a nice weekend.

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-14, 18:06 UTC
by jnauth
And one more info for all other interested in the Copy Timestamp solution. This is how my final solutions looks like. I just added the %S behind the Source and the Target, which make the Timestamp Copy Feature run only for the selected Folder under the Cursor.

That was actually what I was looking for (without the %S the whole Source Folder incl. all directories get timestamped, but with the %S parameter I can choose only one dedicated folder which I want to timestamp.

Of course it would be nice if this could be automatized for the wholeset of selected directories in thwe TC Source Folder, but since Robocopy can´t be feed with a Filelist this is not possible (except may be writing all all Directory Names with %S parameter first in a file list. And then invoke a batch which will loop the Robocopy command for all items in the file list)

TOTALCMD#BAR#DATA
robocopy.exe
? /e /timfix /copy:t /dcopy:t "%P%S " "%T%S "
D:\Programme\Win-Commander\Timestamp.ico
Copy timestamps from the source to the target directory

Re: Copy Timestamp Feature (only for marked directories)

Posted: 2025-02-14, 20:13 UTC
by Fla$her
jnauth wrote: 2025-02-14, 18:06 UTC This is how my final solutions looks like.
Judging by the results, you still haven't grasped what I wrote about slowing down.
jnauth wrote: 2025-02-14, 18:06 UTC I just added the %S behind the Source and the Target, which make the Timestamp Copy Feature run only for the selected Folder under the Cursor.
Are you sure you have studied the help? %S returns a list of selected items. If you select and move the cursor at least once, the item under the cursor will no longer be included in the command. Change to %N.
jnauth wrote: 2025-02-14, 18:06 UTC but since Robocopy can´t be feed with a Filelist this is not possible (except may be writing all all Directory Names with %S parameter first in a file list.
%S returns names. Robocopy supports a namemask after specifying the source and target paths. This is also a list, only in a line.