Recursive touch
Linux/Unix, Shell script June 30th, 2007
“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% [?]
About
Leave a Comment