I am working on a command to move the x number of oldest files(FIFO) into a directory, is it better idea to pipe the "find" result into "ls" or just use the "ls" .. please suggest.
ls -ltr `/bin/find ${in}/* -prune -name "*.txt" -type f` | head -10 |
while read -r infile ; do
-move the file
done
or should i just use ls.
the reason i am using find is: i read some online content that ls should be avoided in scripting. but in my code at the end i have to pipe the find results into the ls.
i am worried if find result is too big would it might cause any problem.