W
W
weranda2018-01-17 10:51:24
PHP
weranda, 2018-01-17 10:51:24

How to delete all folders and files in a certain folder using Cron except the ones you need?

Greetings
I configured Cron to delete all files (folders) in a folder with the command:

rm -rf /home/.../site.ru/public_html/var/cache/registry/*

But in the registry folder there are several folders and files that I would not like to delete:
- CSS (folder)
- JS (folder)
- .htaccess (file)
- myfile.php (file) I got
acquainted with the Linux commands, but I didn’t get something I can how to exclude the necessary folders and files from deletion. Please tell me how to set up.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Saboteur, 2018-01-17
@weranda

Try like this
You can do it without -delete first to see a list of what needs to be deleted.
You can do multiple finds.

A
Alexander Wolf, 2018-01-17
@mannaro

www.it-article.ru/linux/udaleniya-fajla-ili-katalo...

D
Dmitry, 2018-01-17
@Tabletko

use find -deleteluke

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question