find . \( \
! -path '.' \
! -iname '.env' \
\
! -path './config' \
\
! -path './logs' \
! -path './logs/*' \
\
\) -delete # or -print
Code language: Bash (bash)
Delete except a file:
find . \( \
! -path '.' \
! -iname 'index.php' \
\) -delete
Code language: JavaScript (javascript)
Leave a Reply