I need to add a script which will delete files from directory before installation of new version. I need save from directory one catalog – /logs and all files inside ( inside we have *.log and *.zg files)
Ive created this line : find /directory/path/* ! -name 'logs' -type d,f -exec rm -r -v {} +
But in Debian 11 Its cleaning also my files inside of catalog log.
Do you know what can be a reason ?
It works on zsh on macbook m1 and is not cleaning my log catalog.
Take Care : )
Expectation
bash script which delete all catalogs and files from given directory EXCEPT one catalog /log and all files inside ( inside we have *.log and *.zg files) .
Szymon Karbowski is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2