Does find subdir -printf "%A
" a bad example which is mentioned in the documentation?
On 20120328_191216, Regid Ichira wrote:
> $ zgrep -A3 '%A%p' /usr/share/info/find.info.gz
> newest=$(find subdir -newer timestamp -printf "%A%p
> sort -n |
> tail -1 |
> cut -d: -f2- )
> is taken from findutil's (4.4.2-4) documentation. It doesn't work
> $ mkdir -v subdir
> mkdir: created directory `subdir'
> $ touch subdir/file
> $ find subdir -printf "%A%p
> $ find subdir -printf "%A
> I think the documentation's example assumes "%A
" is supposed to
> print time information as is. While, in fact, there must be a
> modifier after the 'A'. Does
> find subdir -printf "%A
> print time information for you? Am I right that the documentation's
> example assume it should work as is?
> Does the example also bad with respect to "%p"? If so, what is the
> correct formatting?
find subdir -printf "%Ap
" prints AM or PM depending on the file's
access time in the local time zone of the computer. You string together
a bunch of %A each followed by a single letter from the list of letters
just below the %A under -printf in the man page to get a useful printing
of the file access time. i.e. there must be a 'k' and 'k' must be one
of the characters from that list ( including k can be @ even though @
is above the column heading of allowed k values ) I know this is confusing.
Try testing with
find subdir -printf "%A@ %Ap
and see a somewhat useless but educational, I hope.
In place of the space in this trial, put a hyphen [-]
find subdir -printf "%A@ %Ap %f
to include the base name of the file without the path from subdir.
find subdir -printf "%i %b %M %n %U %G %s %TY%Tm%Td_%TH%TM%TS %p
This is one I use and find convenient for some work. Figure out how it
works, and then write, and contribute a better man page. I would have
appreciated it when I was learning, but now that I know the truth I
can't see a better way to say it than is already there.
Paul E Condon
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org