Is your purpose to delete the oldest 40 files in a directory?
something like:
Code:
ls -tr | head -n2 | xargs rm
You don't want -l, because it will give you other garbage that you don't need. Please test this before rolling into production, so you understand it.
Modify -n2 to -n40 once it has been tested.