TOUCH a directory?

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

dim

Dimitry Andric
May 31, 2008
203
0
Netherlands
#2
On 2008-11-28 15:27, Stefano Piccardi wrote:

> Does anyone know how to change the creation and last access dates of a directory? TOUCH does not support directories. Thanks.
The TOUCH help says:

"By default, TOUCH affects only files. You must utilize the /A: option to include directories. /A:D will select directories only."
 
#3
Stefano Piccardi wrote:
| Does anyone know how to change the creation and last access dates of
| a directory? TOUCH does not support directories. Thanks.

The method was mentioned by others. However, changing the "last accessed"
date of a directory is almost always a wasted effort. Almost any action
relating to a directory updates its access date.
--
Steve
 
May 31, 2008
376
2
#4
Thank you both for your replies.
I had to fight TCC a bit to find a way to touch a directory tree without touching its files. The trick is that it seems TOUCH /A: works only when the directory name is "." at least for me. Any other full or relative directory path triggers an error. So, given %root%, the path of the tree root directory,
pushd
cdd /n "%root%"
global /q touch /a: /q /tw08:15 .
popd
resets the write time of root and all its sub-directories to 8:15.