# Setting up file flags automatically



## bbzz (Oct 9, 2011)

Is it possible to automatically set flags for certain files created at certain place the moment they are created?

For instance

```
#chflags -R sunlnk /somedir
```
will make all files undeletable under that dir; but can it be done the moment file is created?


----------



## SirDice (Oct 10, 2011)

Simple answer, no.


----------



## DutchDaemon (Oct 10, 2011)

chflags are not inherited, so when a parent directory has chflags set, files created in it will not inherit those flags. Note that in the case of some flags (e.g. schg), creating files in that directory would become impossible anyway .. Setting up a cron job would be your best best.


----------

