I want to locate all folders on my server that end with 'wordpress-seo'.
I tried find command but it takes too long.
sudo find /home/w/s -type d -name 'wordpress-seo'
Now I am trying locate
command but it returns all paths that have wordpress-seo.
a/wp-content/plugins/wordpress-seo
a/wp-content/plugins/wordpress-seo/languages/
...
...
I want to exclude wordpress-seo/*
files and folders. I just want folder names. i.e.
a/wp-content/plugins/wordpress-seo
b/wp-content/plugins/wordpress-seo
Tried regex without any luck.
locate -r '/\w+wordpress\-seo/b'
OR
locate '/*/wordpress-seo/'
Any Help??
Best Answer
Try this:
Although i should mention that
find
offers huge variations of options overlocate
. You have foundlocate
faster because it just reads from a database/var/lib/mlocate/mlocate.db
whilefind
search through files every time, whenever you give it something to search.locate
's database is updated bycron
on a daily basis, you can also update the database manually anytime by:This will make the files created after the daily
cron
update available in thelocate
database, so you will find those vialocate
. Also check the configuration file/etc/updatedb
to see which filesystems, paths are being excluded.