Reputation: 33
I would like to generate an empty file "foo" in all directories that contain a file "bar" (by using the find command to find the files and then the -exec option to create the file in these directories)
Upvotes: 3
Views: 32
Reputation: 74685
You said it (almost):
find -name "bar" -execdir touch foo \;
-execdir
executes from the directory in which the file was found. touch
creates an empty file.
Upvotes: 2