2000-04-04-14:37:48 Jim Toth:
> >     find Mail -maxdepth 1 -printf '=%P\n'
> 
> Right, but if you don't have Maildir, and want, say
> =oldmail/something, then that would turn into =something, which would
> be wrong.  (although of course it wouldn't get there to begin wth b/c
> of the maxdepth).

Actually, no, %P isn't "basename", it's "leave off the constant
prefix that's the command-line argument find started its search
from". So if you aren't using Maildirs and so want recursion, the
command could be

        find Mail -printf '=%P\n'

Season with "! -name whatever" to taste.

BTW, GNU find has %f for basename, and %h for the directories torn
off by that basename (i.e. including the command-line argument), and
%H for the command-line argument, so these invocations are
equivalent:

        find ... -printf '%p\n'
        find ... -printf '%H/%P\n'
        find ... -printf '%h/%f\n'

except that they do different things on the line that prints the
argument itself --- the first one prints it plain, the second one
appends a slash, and the third one prepends a slash.

-Bennett

PGP signature

Reply via email to