Skip to content

Instantly share code, notes, and snippets.

@T1T4N
Last active November 28, 2017 14:44
Show Gist options
  • Save T1T4N/f26f1fd98cc55c16137c0527a8f344d5 to your computer and use it in GitHub Desktop.
Save T1T4N/f26f1fd98cc55c16137c0527a8f344d5 to your computer and use it in GitHub Desktop.
Command that adds a "-i" file in every subdirectory to prevent "rm -rf *" expansion
# rm -rf * will treat -i as an option and ask for deletion
find . -maxdepth 1 -type d -iname "*" -exec touch {}/-i \; -exec chflags hidden {}/-i \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment