2

Exclude the list of files from the search

 3 years ago
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.
neoserver,ios ssh client

Exclude the list of files from the search

advertisements

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

How to get a list of files from hdfs (hadoop) directory using python script? I have tried with following line: dir = sc.textFile("hdfs://127.0.0.1:1900/directory").collect() The directory have list of files "file1,file2,file3....fileN"

FTPClient can not get the list of files from a directory name with space

I am using Apache FTPClient for getting files and sub-directory files listing. But it cant get listing of files from directory name with spaces. Here is an example - I tried it with two different directories: FTPClient client = new org.apache.commons

Add a border to jquery datatable excluding the search bar

this might be an easy question, but i need your help. How to add border to jquery datatable excluding the search bar? I tried using css but the border include the search bar. .table1{ border-width: 1px; border-style:solid; border-color: #A1A1A1; } $.

How to get a list of files from a directory

Hi I am having a hard time searching for this problem. I know how to open a folder from my c# application, for that I have used below code string name = lstEmployees.Text; Process.Start(@"H:\"+name); but I want to know how to get the list of fil

Batch file to list all files from a date range

I need to do a batch file which order all files by a date interval, example: @echo off echo Input the date(dd/mm/yyyy): set /p compDate= ::After that I will compare from the actual day (%date%), example: set interval = %compDate% - %date%... *Somethi

How to get a list of files from a specific folder in internal storage?

With listFiles() I can get list of file in /data/data/package/files. How can I get list of files from directory like /data/data/package/myfolder ? Thanks.Your application has a "Files" and "Caches" directory. You can query this path wi

how to get a list of files from a directory to a text file using Python

This question is how to get list of files from a directory into text file using python. Result in the text file should exactly be like this: E:\AA\a.jpg E:\AA\b.jpg ... How to correct the code below: WD = "E:\\AA" import glob files = glob.glob (

How to exclude a specific CSS file from an ASP.NET theme?

I'm making a website that will have to render correctly on FF/IE6/IE7/Opera/Safari. IE6 came as a late requirement (when I had done all the other browsers) and it just has to be useable, not necessarily the same as on the other browsers. Now I'm twea

Download the latest modified file created from a list of files from a ftp server to python

I have the next code, which downloads zip files, but I need just the last modified or created file from the ftp, not all of them. For example, I have: one_20140220.xml.zip one_20140221.xml.zip one_20140222.xml.zip In this case I need to download just

Unable to get a list of files from the standard resource directory in the Maven project with Spring PathMatchingResourcePatternResolver

NOTE: As per the accepted solution below, this appears to be realated only to the fact that Spring's DefaultResourceLoader does not use the classloader to create URL instances for resources, thus custom classloaders are ignored https://jira.spring.io

How to grep the contents of the list of files from Linux ls or find the command.

I am running -> find . -name '*.txt' command and getting list of files. I am getting below mention output: ./bsd/contrib/amd/ldap-id.txt ./bsd/contrib/expat/tests/benchmark/README.txt ./bsd/contrib/expat/tests/README.txt ./bsd/lib/libc/softfloat/READ

List of files from the src folder

I want to list all files, that are located in a folder named icons. But the special feature is, that I want to start ot from the src folder in Eclipse. I want to use something like this: File f = new File("src/icons"); File[] fileArray = f.listF

How to get the list of files from an SFTP server?

I have a problem and hoping to get a solution. I also have written some code but it needs some modification. Problem: I have a SFTP server (for privacy purposes I will give dummy credentials) that I need to connect to. Server name: server-name port:

Delete a list of files from the SQL Server table

I have a SQL Server table with a list of file paths for files that I need to delete from my windows system, is there any way I can accomplish this using batch file in command prompt or any software to help me do this?? appreciate any help.You could w

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?

I want to get list of files which were either public folder or shared folder, is there any API without oauth for android application.You can query for the files shared with the authenticated user: service.files().list().setQ("sharedWithMe").exec

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK