Thursday, July 30, 2009

Recursive touch - I blog, therefore I am

Recursive touch - I blog, therefore I am: "Recursive touch
Published on Sat 30 Jun 2007 06:06 ( 2 years, 1 month ago)
Shell script Linux/Unix

'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"

No comments:

Post a Comment