How To Find File or Folder Older Than x Days and Total Size

0
508

Find Folder

Save the output as file

[email protected]:~# du -chs $(find /var/www/html/ -type d -mtime +OlderThanXdays) > find-folder-total-size.txt

Live report (verbose)

[email protected]:~# du -chs $(find /var/www/html/ -type d -mtime +OlderThanXdays)

Find File

Save the output as file

[email protected]:~# du -chs $(find /var/www/html/ -type f -mtime +OlderThanXdays) > find-file-total-size.txt

Live report (verbose)

[email protected]:~# du -chs $(find /var/www/html/ -type f -mtime +OlderThanXdays)

Legend:

du = estimate file space usage

-c, –total = produce a grand total

-h, –human-readable = print sizes in human readable format (e.g., 1K 234M 2G)

-s, –summarize = display only a total for each argument

LEAVE A REPLY

Please enter your comment!
Please enter your name here