[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
find -f -, please?
From: |
Marc Chantreux |
Subject: |
find -f -, please? |
Date: |
Mon, 15 Feb 2016 22:44:11 +0100 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
hello findutils maintainers,
first of all: thanks for maintaining such a usefull set of tools. i'm a
daily user of find.
about the use of the day, i want to use find to filter a list of files.
I can't
find $( a-very-long-list-of-files ) -type f -name '*scm'
because the line exceed the max size of a command so i wrote
a-very-long-list-of-files |
xargs -IX find X -prune -type f -name '*scm'
which works fine regardless the fact the find command was started for
all single file (-I implies -L1).
I finally wrote
a-very-long-list-of-files | perl -lnE 'print if -f && /[.]scm$/'
this isn't a problem on a BSD system as find has the wonderfull -f.
According to http://netbsd.gw.com/cgi-bin/man-cgi?find+1+NetBSD-current
-f Specifies a file hierarchy for find to traverse.
File hierarchies may also be specified as the
operands immediately following the options.
It would be nice to get this feature into the gnu tools. I hope you like
the idea.
I'm not a C expert but i get a naive overview of the source but my start
should start with the patch at the end of the body then
* add the -f support in the code that read the flags
* write a function process_traverse_path inspired by process_all_startpoints
that could be (pseudocode)
foreach name in fflags
handle = name eq '-' ? stdin : fopen(name)
while getline handle, l
find(l)
so if it is correct and there is no maintainer to do the job, i'll be
happy to try to submit a real live patch.
regards
diff --git a/find/ftsfind.c b/find/ftsfind.c
index f9b03e2..c8ca002 100644
--- a/find/ftsfind.c
+++ b/find/ftsfind.c
@@ -729,9 +729,12 @@ main (int argc, char **argv)
* be safe to call cleanup() since we might complete an execdir in
* the wrong directory for example.
*/
- if (process_all_startpoints (argc-end_of_leading_options,
+
+ if ( options.fflags
+ ? process_traverse_path (options.fflags)
+ : process_all_startpoints (argc-end_of_leading_options,
argv+end_of_leading_options))
- {
+ {
/* If "-exec ... {} +" has been used, there may be some
* partially-full command lines which have been built,
* but which are not yet complete. Execute those now.
--
Marc Chantreux (eiro on github and freenode)
http://eiro.github.com/
http://eiro.github.com/atom.xml
"Don't believe everything you read on the Internet"
-- Abraham Lincoln
- find -f -, please?,
Marc Chantreux <=