Showing posts with label Linux Tips. Show all posts
Showing posts with label Linux Tips. Show all posts

Monday, May 18, 2015

Linux : How to recursively touch files and folders in a directory

Guys today we will learn a small tip about touching multiple files / folders in a folder using Linux Terminal.

I assume you know about "touch" command in Linux if not please make sure you read its man page here.

You need to use below command to touch files/folders recursively.
 find . -exec touch {} \;  

Execute this command in the director in which you would like to perform this operation.

This command,

  • Finds each file
  • exec is used to invoke a subprocess "touch"
  • Curly bases and backward slash ending with semicolon as per syntax
Hope you find this tip useful.