You could try echo *
at the command line. In your script you can use it instead of ls -l
or as well as ls -l
(as another line after). This suggestion is to investigate the problem, not to workaround it.
The * is a shell "filename expansion" expression. It will be expanded by the shell and replaced by the names of all files and directories not beginning with . The echo command will write those names to stdout which you can
The reason for asking you to try it is to try something more basic than dir
to show whether the files are visible.
If your ls command has options to change the order files are listed in (like -t, -S, -r) then you could experiment with them and maybe see whether the problem is that ls does not "see" the files or whether its output is is truncated.
At this stage, we are varying the action in the hope of gaining a clearer understanding of the problem.
It's particularly strange that only two of the four very similar "Any Human Heart_<nnnnnn>.rec" files are shown. And ls
is pretty robust ...
Can you try ls -l > lsl.$$.out
when running from cron? That would show whether the problem is with ls
itself or somehow in the post-processing of its output. Can you post the part of the script that runs ls
, up to emailing its output?