find number of files & total size of files modified in last 30 days in Linux [closed]

StackOverflow https://stackoverflow.com/questions/19101650

  •  29-06-2022
  •  | 
  •  

Question

I have a huge file vault (File directory) in Linux where files are added/modified daily, I want to find number of files & total size of files modified in last 30 days in Linux. How can I do it?

Était-ce utile?

La solution

The find command can find the files that have been modified (mtime) or created (ctime) within a certain amount of time. wc can tell you the number of bytes in a group of files. xargs converts words in the standard input into arguments to a command.

find /path/to/vault -mtime 29 -type f | xargs wc -c

find is probably one of the most useful tools for helping to identify files that have properties of interest to you. I guarantee that taking the time to learn it will be time well spent.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top