deleting files in directories but with exclusions of some directories
by goodiemobster from LinuxQuestions.org on (#58QEP)
Hi,
I'm trying to delete files older then 1 year on a server with +1000 vhosts.
location of the files:
/var/www/vhosts/CLIENT1/httpdocs/files/fotos/
/var/www/vhosts/CLIENT2/httpdocs/files/fotos/
...
/var/www/vhosts/CLIENT1000/httpdocs/files/fotos/
I used to do this with a simple:
find /var/www/vhosts/ -type f -name '*.jpg' -mtime +356 -exec rm {} \;
This worked very good but now some clients don't want these files removed.
Is there a way to exclude multiple /CLIENTX/httpdocs/files/fotos directories?
It would be great if I could put these in a blacklist.txt or something which i can simply adjust before running the removal command.
I'm new here and relatively new to linux, if i did not post this in the right forum, my excuses!


I'm trying to delete files older then 1 year on a server with +1000 vhosts.
location of the files:
/var/www/vhosts/CLIENT1/httpdocs/files/fotos/
/var/www/vhosts/CLIENT2/httpdocs/files/fotos/
...
/var/www/vhosts/CLIENT1000/httpdocs/files/fotos/
I used to do this with a simple:
find /var/www/vhosts/ -type f -name '*.jpg' -mtime +356 -exec rm {} \;
This worked very good but now some clients don't want these files removed.
Is there a way to exclude multiple /CLIENTX/httpdocs/files/fotos directories?
It would be great if I could put these in a blacklist.txt or something which i can simply adjust before running the removal command.
I'm new here and relatively new to linux, if i did not post this in the right forum, my excuses!