Find command Exclude or Ignore Files (e.g. Ignore All Hidden .dot Files )

ht‮spt‬://www.lautturi.com
Find command Exclude or Ignore Files (e.g. Ignore All Hidden .dot Files )

To exclude or ignore certain files when using the find command, you can use the -name option with the ! operator to negate the search.

For example, to ignore all hidden .dot files, you can use the following command:

find /path/to/search ! -name ".*"

This will search for all files in the specified directory (/path/to/search) and its subdirectories, except for those that have a name starting with a . (e.g., hidden .dot files).

You can also use the -regex option to specify a regular expression to match the names of the files you want to ignore. For example:

find /path/to/search ! -regex ".*\.dot$"

This will search for all files in the specified directory (/path/to/search) and its subdirectories, except for those that have a .dot extension.

Keep in mind that the -name and -regex options are just a few of the many options available for filtering the results of a find command. For more information on the find command and its options, you can refer to the documentation or use the man command to view the manual pages.

Created Time:2017-10-28 20:14:18  Author:lautturi