“touch” is a unix command used to change the time of a file or directory, touch a directory will not touch the files inside.

To touch recursively, it’s simple with the help of “find” and “xargs”:

e.g.

find . | xargs touch

will touch all files and directories recursively under current directory.

Since directory or filename may contain spaces, the shell script need some additional parameteres:

find "$1" -type f -print0 | xargs -0 touch

Popularity: 11% [?]



Leave a Comment

Close
E-mail It
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.