Peter Farley wrote: > I thought the following would produce "ls -l" output > for the space-separated list of files selected by the > "find" options, but instead I get an error message > from "ls": > > $ find a -daystart -type f -mtime 7 -printf " %p"|ls > -l - > ls: -: No such file or directory > > The output from the "find" looks like this: > > $ find a -daystart -type f -mtime 7 -printf " %p" > a/list.txt a/list_0002.txt
I've never heard of using '-' to ls this way. The coreutils info page does list it as a common flag, but my interpretation of the language there is that it's only referring to programs that act as input/output filters, not as a general-purpose way of passing filename arguments. That's why xargs exists. You can get ls-like output from find without any other programs: find a -daystart -type f -mtime 7 -ls If you must use an external program, the usual way to take the output from find and send it as arguments is with xargs: find a -daystart -type f -mtime 7 | xargs ls -l Note that both this and your '-printf " %p"' method will not work for filenames that contain spaces or special characters. Therefore the superior way of doing this is: find a -daystart -type f -mtime 7 -print0 | xargs -0 ls -l > I do not have an *ix system on which to test if this > is a Cygwin coreutils problem or a misunderstanding by > me of the operation of the "-" option. Can you please > tell me if I am wrong about my use of the "-" option? It doesn't work under linux either. (It's the same coreutils code in either case.) Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/