Best Answer: How Do I Delete a Linux Month Wise?

Best Answer: How Do I Delete a Linux Month Wise?
Contents

How do I delete a specific month in Linux?

To do this, change rm to ls -la . Combine this with grep you can filter the list to the months that you want: $ stat -c ‘%n %z’ foo bar | grep -E ‘^2012-0[45]-.. ‘

How do I delete a 3 month file in Linux?

You can either use the -delete parameter to immediately let find delete the files, or you can let any arbitrary command be executed ( -exec ) on the found files. The latter is slightly more complex, but offers more flexibility if want to copy them to a temp directory instead of deleting.

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.