How to scan a linux file based on creation time?

Asked

Viewed 55 times

3

I am mounting a backup script and need to create a scan to analyze if any file in a folder was created in the last 7 days, what is the path to it? I know the command ls -lt lists the files in the order of last creation or change and shows the month, day, hour and minute, how I can use this information?

  • Depending on what you’re doing, take a look at the logrotate,

1 answer

4


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

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

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

If you want, you can delete these files:

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

I hope it will be useful.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.