Thursday, July 11, 2013

Why is the syntax for touching a file from the command prompt so strange?

The magic incantation for updating the last-modified date on a file is

What strange syntax! What's with the plus sign and the commas, anyway?

The formal syntax is the much more straightforward

This means to start with the file A, then append the files B, C, and D, treating them all as binary files.

If you omit the B+C+D part, then you get

This means "Start with A, then append nothing." The side effect is that the last-write time gets updated, because the command processor opens A for append, writes nothing, then closes the handle.

QR: Inline image 1