Re: put find output in an array
2006-08-26, 13:15(-04), kenneth kahn:
[...]
> If you use somthing like KSH93 or equivalent, you can do
>
> set -A files 0 $(find . -mtime ${maxTime})
ITYM
IFS=$'\n'
set -f
set -A files 0 $(find . -mtime "$maxTime" -print)
which is slightly better but not correct yet.
You need GNU find and zsh for the task.
IFS=$'\0'
files=($(find . -mtime $maxTime -print0))
or simply as zsh has find functionality builtin:
files=(./**/*(ND.m$maxTime))
--
Stéphane
|