I wanted to execute a script that picks out a random directory path:
find / -type d | shuf -n1
Unfortunately I get error messages about the prohibition of entering certain directories.
How can I exclude a directory from the search with find ?
command linefind
I wanted to execute a script that picks out a random directory path:
find / -type d | shuf -n1
Unfortunately I get error messages about the prohibition of entering certain directories.
How can I exclude a directory from the search with find ?
Best Answer
To exclude specific paths, on Linux:
Another approach is to tell
find
not to recurse under different filesystems.You could also use locate to query a database of file names (usually updated nightly, you could also update it manually using
updatedb
) instead of the live system.