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

TOUCH a directory?

Discussion in 'Support' started by Stefano Piccardi, Nov 28, 2008.

  1. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    Does anyone know how to change the creation and last access dates of a directory? TOUCH does not support directories. Thanks.
     
  2. dim

    dim Dimitry Andric

    Joined:
    May 31, 2008
    Messages:
    202
    Likes Received:
    0
    On 2008-11-28 15:27, Stefano Piccardi wrote:

    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. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    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
     
  4. Stefano Piccardi

    Joined:
    May 31, 2008
    Messages:
    376
    Likes Received:
    2
    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.
     

Share This Page