With zsh
:
print -rC1 -- ${PWD%/}/path_to_dir/*(NDom.) # regular files only
print -rC1 -- ${PWD%/}/path_to_dir/*(NDom^/) # any type of file except
# directory (so includes
# symlinks, fifos, devices,
# sockets... in addition to
# the regular files above)
print -rC1 -- ${PWD%/}/path_to_dir/*(NDom-^/) # any type except directory
# but this time the type is
# determined after symlink
# resolution so would also
# exclude symlinks to
# directories.
print -rC1 -- ${PWD%/}/path_to_dir/*(ND-om^/) # same but also use the
# modification time of the target
# of symlinks when sorting
print -rC1 -- path_to_dir/*(ND-om^/:P) # same but print the real path for each
# file. That is, make sure it's absolute
# and none of the path components
# are symlinks.
${PWD%/}
is to handle the case where $PWD
is /
so we get /path_to_dir/files
instead of //path_to_dir/files
.
That ${PWD%/}/
is only to be prepended to relative paths (such as path_to_dir
) to make them absolute, not for paths that are already absolute (such as /absolute/path_to_dir
).
So for your /var/reports
, use print -rC1 -- /var/reports/*(...)