Exclude the list of files from the search
source link: https://www.codesd.com/item/exclude-the-list-of-files-from-the-search.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Exclude the list of files from the search
If I have a list of filenames in a text file that I want to exclude when I run find
, how can I do that? For example, I want to do something like:
find /dir -name "*.gz" -exclude_from skip_files
and get all the .gz files in /dir except for the files listed in skip_files. But find has no -exclude_from
flag. How can I skip all the files in skip_files
?
I don't think find
has an option like this, you could build a command using printf
and your exclude list:
find /dir -name "*.gz" $(printf "! -name %s " $(cat skip_files))
Which is the same as doing:
find /dir -name "*.gz" ! -name first_skip ! -name second_skip .... etc
Alternatively you can pipe from find
into grep
:
find /dir -name "*.gz" | grep -vFf skip_files
Related Articles
Get a list of files from the hdfs directory (hadoop) using the Python script
FTPClient can not get the list of files from a directory name with space
Add a border to jquery datatable excluding the search bar
How to get a list of files from a directory
Batch file to list all files from a date range
How to get a list of files from a specific folder in internal storage?
how to get a list of files from a directory to a text file using Python
How to exclude a specific CSS file from an ASP.NET theme?
Download the latest modified file created from a list of files from a ftp server to python
Unable to get a list of files from the standard resource directory in the Maven project with Spring PathMatchingResourcePatternResolver
How to grep the contents of the list of files from Linux ls or find the command.
List of files from the src folder
How to get the list of files from an SFTP server?
Delete a list of files from the SQL Server table
How do I get a list of files from the public or shared folder from the drop-down list or the Google Drive without authentication?
Recommend
-
6
Exclude parameter from Parameter Binding in WebAPI By Dan Nemec 23 Oct 2014 Lately I’ve been working on some WebAPI code with ActionFilters that inject parameters into the WebAPI action. For example, we authentic...
-
10
SEM A Google Ads setting allowed advertisers to exclude people of ‘unknown gender’ Employers, landlords and cr...
-
18
Conan 1.36 brings several significant enhancements, including several different enhancements to CMake integration, a new property strategy for cer...
-
12
Exclude lines in less (or journalctl)Skip to main content Exclude lines in less (or journalctl) Published: 23-05-20...
-
9
Exclude automatic properties from code coverage in Visual Studio 2015 advertisements I just upgraded a bunch of projects to VS2015/C#6.
-
9
Magento - SQL command to define & ldquo; Exclude & rdquo; On product images advertisements I'm wondering if there's some SQL command I...
-
8
How to include only the selected files in the git repository and exclude everything else? advertisements Is there any chance to do an opposite...
-
6
We will try to understand this by taking example of multiple themes support. Multiple theme files Let’s assume that apart from main styles.css file, you have 2 theme files present: src/styles/the...
-
3
How to Exclude Unnecessary Files From Static Analysis? [Excluding Files] Few projects can do without outside libraries and other useful ready-made solutions. However, analyzers can see the whole code and check it with abandon....
-
3
How to Exclude Pages from WordPress Search Results #wordpress
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK