How to do a check in a linux file based on creation time?

3

I am mounting a backup script and need to create a check to see if any files in a folder were created in the last 7 days, what is the way to do this? I know that the ls -lt command lists the files in the order of last creation or change and shows the month, day, hour and minute, how can I use this information?

    
asked by anonymous 09.07.2018 / 19:00

1 answer

4
find /home/pasta_alvo -type f -mtime +7

1 - find /home/pasta_alvo -type f (to find the files)

2 - -mtime +7 (7 days of creation)

If you wish, you can delete these files:

find /home/pasta_alvo -type f -mtime +7 -exec rm -rf {} \;
  • -ctime = created
  • -mtime = modified
  • -atime = accessed

I hope it's useful.

    
09.07.2018 / 19:37