Skip to main content

All Questions

2 votes
4 answers
2k views

Delete folders but keep 20 newest, 7 days old

I am looking for a way to delete folders that are older than 7 days, but always have 20 newest folders. similar named folders with _SAME_NAME_@tmp should be deleted as well. I'm stuck with making ...
soBusted's user avatar
  • 941
0 votes
2 answers
333 views

List lastest modified or newly created files in linux

How to list modified or newly created files or directories in linux. So that I can trigger another command or shell script for another task. for eg. A file a.txt and test.txt are modified and I ...
tomashubham's user avatar
7 votes
5 answers
11k views

How to delete all directories in a directory older than 2 weeks except the latest one that match a file pattern?

I have the following path: /dir1/dir2/ In this path I have the following directories containing various (not relevant) application detrius: follower1234 1-Dec-2018 follower3456 2-Dec-2018 ...
hawkeye's user avatar
  • 505
1 vote
1 answer
70 views

Deleting old directory

I am trying to add a way to remove backups older than 3 days ago in my script. See below a stripped down simplified version, which just leaves the removal part. It was my understanding that ${...
ccdavies's user avatar
  • 281