Documentation touch

Oct 18, 2008
273
1
#1
Hello -- does the TOUCH command when used with the /r switch update all 3 timestamps? modify, access, create times?
 
Oct 18, 2008
273
1
#3
WOW thanks for the shortcut ... there is a bug in robocopy introduced by kb3125574 that now robocopy is using the access time to
copy the source to the target is the source time is later than the target time -- using touch I should be able to get around this problem -- thanks
 
Oct 18, 2008
273
1
#3
WOW thanks for the shortcut ... there is a bug in robocopy introduced by kb3125574 that now robocopy is using the access time to
copy the source to the target is the source time is later than the target time -- using touch I should be able to get around this problem -- thanks
 

rps

Jul 6, 2008
378
4
#4
Starting state of file dates:
Code:
d:\tcmd v22>filedates.btm history.sav test1.tmp
─────────────────────────────────────────────────────────────────────────────────────────────
history.sav
 Creation Date: 10/26/2017 00:48
 Last Mod/Write Date: 12/12/2017 19:53
 Access Date: 12/07/2017 17:57
─────────────────────────────────────────────────────────────────────────────────────────────
test1.tmp
 Creation Date: 12/13/2017 15:09
 Last Mod/Write Date: 12/13/2017 16:26
 Access Date: 12/13/2017 17:27
Attempting to update all three file dates using a command copied from above:

Code:
d:\tcmd v22>touch /r:w /r:c /r:a history.sav test1.tmp & filedates.btm history.sav test1.tmp
12/07/2017 17:57:18.427  D:\TCMD v22\test1.tmp
───────────────────────────────────────────────────────────────────────────────────────────────────
history.sav
 Creation Date: 10/26/2017 00:48
 Last Mod/Write Date: 12/12/2017 19:53
 Access Date: 12/07/2017 17:57
───────────────────────────────────────────────────────────────────────────────────────────────────
test1.tmp
 Creation Date: 12/13/2017 15:09
 Last Mod/Write Date: 12/13/2017 16:26
 Access Date: 12/07/2017 17:57
Only the /r:a is updated/copied
Trying without the /r:a changes a source date/time as well as a target date/time. The source and target date/times are updated with the current system time and the targets date. Totally unexpected.
Code:
d:\tcmd v22>touch /r:w /r:c history.sav test1.tmp & filedates.btm history.sav test1.tmp, still without affecting the creation date/time.
12/13/2017 16:30:16.863  D:\TCMD v22\history.sav
12/13/2017 16:30:16.863  D:\TCMD v22\test1.tmp
────────────────────────────────────────────────────────────────────────────────────────
history.sav
 Creation Date: 10/26/2017 00:48
 Last Mod/Write Date: 12/13/2017 16:30
 Access Date: 12/07/2017 17:57
────────────────────────────────────────────────────────────────────────────────────────
test1.tmp
 Creation Date: 12/13/2017 15:09
 Last Mod/Write Date: 12/13/2017 16:30
 Access Date: 12/07/2017 17:57
The only method to copy the sources creation date/time, that succeeded, was to use "touch /r:c History.sav test.tmp" alone.
The changes to the source date/time baffle me, since I did not expect the source date/time to ever change with using /r:.
I assume this is WAD so I'm back to using the /r:[acw] individually.
BTW, I tried this in V21 with similar results.
 
#6
No. TOUCH will only modify a single timestamp per /R invocation.
But you could cheat a bit with:
TOUCH /r:w /r:c /r:a sourcefile targetfile
I saw that. It doesn't work.
Code:
v:\> touchall 00:00:00 a1
2017-12-14 00:00:00.000  V:\a1
2017-12-14 00:00:00.000  V:\a1
2017-12-14 00:00:00.000  V:\a1

v:\> filetimes a2
Created:  2017-12-13 19:33:03
Accessed: 2017-12-13 19:33:03
Modified: 2017-12-13 19:33:41

v:\> TOUCH /r:w /r:c /r:a a1 a2
2017-12-14 00:00:00.000  V:\a2

v:\> filetimes a2
Created:  2017-12-13 19:33:03
Accessed: 2017-12-14 00:00:00
Modified: 2017-12-13 19:33:41
This works (third command below) but it's a tad cumbersome.
Code:
v:\> touchall 11:11:11 a1
2017-12-14 11:11:11.000  V:\a1
2017-12-14 11:11:11.000  V:\a1
2017-12-14 11:11:11.000  V:\a1

v:\> filetimes a2
Created:  2017-12-14 00:00:00
Accessed: 2017-12-14 00:00:00
Modified: 2017-12-14 00:00:00

v:\> TOUCH /r:w a1 a2 /r:c a1 a2 /r:a a1 a2
2017-12-14 11:11:11.000  V:\a2
2017-12-14 11:11:11.000  V:\a2
2017-12-14 11:11:11.000  V:\a2

v:\> filetimes a2
Created:  2017-12-14 11:11:11
Accessed: 2017-12-14 11:11:11
Modified: 2017-12-14 11:11:11
 

rps

Jul 6, 2008
378
4
#7
I saw that. It doesn't work.
Code:
''''''''''''''''''''''''''''''''''''''''''''
This works (third command below) but it's a tad cumbersome.
Code:
.......................................
v:\> TOUCH /r:w a1 a2 /r:c a1 a2 /r:a a1 a2
2017-12-14 11:11:11.000  V:\a2
2017-12-14 11:11:11.000  V:\a2
2017-12-14 11:11:11.000  V:\a2

v:\> filetimes a2
Created:  2017-12-14 11:11:11
Accessed: 2017-12-14 11:11:11
Modified: 2017-12-14 11:11:11
Agreed, but that's what aliases are for; right? :playful: