List specific files and delete results
Hello people,
A simple questions, I ran the command: Code:
ls -ltr | head -n40 Thanks! |
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. |
Always nice to learn something new and useful in Linux :)
thanks buddy! |
All times are GMT -5. The time now is 03:42 AM. |