Skip to content

Instantly share code, notes, and snippets.

@RinatValiullov
Created July 16, 2018 05:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RinatValiullov/ac87f6303cff5c94f0e7e4c60979449f to your computer and use it in GitHub Desktop.
Save RinatValiullov/ac87f6303cff5c94f0e7e4c60979449f to your computer and use it in GitHub Desktop.
Add file in several directories
#!/bin/bash
# Add file in several directories
# find . -type d --> searchs directories in the directory structure
# -exec touch {}/hiya \; --> given each result, its value is stored in {}.
# So with touch {}/hiya what we do is to touch that "something"/hiya. The final \; is required by exec in find clauses.
find . -type d -exec touch {}/sample.txt \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment