Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 19091  / 1 Year ago, tue, may 16, 2023, 11:37:39

I have a IP cam which save its recordings in a specific directory named Camera1 in my Ubuntu Server 12.04.



I would like to limit the size of this folder to 5 gigs, by deleting -say once a day- the oldest files.



I first checked the quota program but it doesn't seem to allow the creation of new files and deleting of the old ones.



So I think the best method would be to run a bash script...


More From » bash

 Answers
4

The find command can be used to find files and delete them. The following command, for example, will delete files created more than seven days ago:



find /path/Camera1 -ctime +7 -delete 


Use crontab if you want to schedule it; there is more information here.


[#36133] Thursday, May 18, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raldership

Total Points: 222
Total Questions: 115
Total Answers: 124

Location: North Korea
Member since Fri, Nov 4, 2022
2 Years ago
;