... from multiple locations ...
You can specify multiple starting points
for a single find
command.
Do
find /home/user1/Out/vendor /home/user2/Out/vendor /home/user3/Out/vendor /home/user4/Out/vendor … /home/usern/Out/vendor -mtime +7 -delete
or
find /home/user1/Out/vendor /home/user2/Out/vendor /home/user3/Out/vendor \
/home/user4/Out/vendor … /home/usern/Out/vendor -mtime +7 -delete
for readability.
But you don't have to explicitly list all the directories like that.
If you're literally dealing with
user1
, user2
, ..., usern
,
(where n
is a number), you can do
find /home/user{1,2,3,4,…,n}/Out/vendor -mtime +7 -delete
or evenfind /home/user{1..n}/Out/vendor -mtime +7 -delete
(using literally two dots (.
), a.k.a. period or full stop) in bash.
But I guess you probably aren't literally dealing with
user1
, user2
, ..., usern
;
your users probably have names.
But the same principle applies; you can do
find /home/{user1,user2,user3,user4,…,usern}/Out/vendor -mtime +7 -delete
For example,find /home/{alice,bob,cathy,david,…,nathan}/Out/vendor -mtime +7 -delete
or evenfind ~{alice,bob,cathy,david,…,nathan}/Out/vendor -mtime +7 -delete
man find
yet? – nohillside Dec 08 '18 at 10:51