touch sensitive to order of options

Mar 20, 2009
35
0
#1
I tested a directory date change via touch with the /n option
TCC showed the proposed change. When I removed the /n the change failed. I had to put the /a:d option first and remove the \ from the directory name. See below:

C:\...d\AppData\Local\Temp>md testdater

C:\...d\AppData\Local\Temp>touch /n /d01-10-2000 /a:d testdater\
1/10/2000 13:06:53.193 C:\Users\Howard\AppData\Local\Temp\testdater\

C:\...d\AppData\Local\Temp>touch /d01-10-2000 /a:d testdater\
TCC: (Sys) The system cannot find the file specified.
"C:\Users\Howard\AppData\Local\Temp\testdater\"

C:\...d\AppData\Local\Temp>touch /a:d /d01-10-2000 testdater\
TCC: (Sys) The system cannot find the file specified.
"C:\Users\Howard\AppData\Local\Temp\testdater\"

C:\...d\AppData\Local\Temp>touch /a:d /d01-10-2000 testdater
1/10/2000 13:07:34.939 C:\Users\Howard\AppData\Local\Temp\testdater

C:\...d\AppData\Local\Temp>
 

rconn

Administrator
Staff member
May 14, 2008
10,533
94
#2
The problem isn't with the order of the options, it is with the trailing \ on the directory name, which the Windows API is choking on. (Most of the Windows APIs accept a trailing \ on a directory name, but not this one.)

The /N option doesn't actually call the change date/time API, so it won't fail with a trailing \.

You don't have to put the /A:D first:

touch /d01-10-2000 /a:d testdater
works fine.
 
#3
---- Original Message ----
From: rconn
| The problem isn't with the order of the options, it is with the
| trailing \ on the directory name, which the Windows API is choking
| on. (Most of the Windows APIs accept a trailing \ on a directory
| name, but not this one.)

The next release of TCC might truncate trailing \ from names passed to this particular API, thus allowing TCC users to treat all commands uniformly in this respect(be better than the API). Not a high priority, since directory dates (except creation) are automatically updated whenever directory content changes (modification date) or the directory is accessed. Rex, do not bother to respond to this suggestion. If you do it, it will be in "What's New", if you don't, we will live with it as we had for many years.
--
Steve