My psychic powers tells me that you tested this with echo $FILES
, which printed all the files on one line, leading you to believe that $FILES
was spaces separated. This is not the case.
With echo $FILES
, the shell word splits the variable on spaces and line feeds into multiple arguments, which echo
then joins with spaces. If you use echo "$FILES"
, you'll see that it is in fact line feed separated.
The quick fix is to print the file names space separated (requires GNU find or other find with -printf
). As per comment, it also omits the search path:
FILES=`/usr/bin/find /u01/app/dw/admin/dgwspool -type f -daystart -mmin -1621 -printf '%P '`;