Home > database >  Creating a placeholder file in multiple sub-directories at once
Creating a placeholder file in multiple sub-directories at once

Time:03-04

Using find and passing the results to touch we can create a file -placeholder/dummy- in multiple dirs:

find . -type d -exec touch {}/someFile \;

however the find . -type d also returns -and creates- a file in the current directory.

What would the command be to just create files in the sub dirs but not the current dir?

CodePudding user response:

There is the -mindepth option:

find . -type d -mindepth 1 -exec touch {}/someFile \;
  • Related