0

I have a ubuntu server 12.10 which receives images from a camera by FTP, I receive the images in a directory with a fixed quote on the server and I need to delete the oldest images first, I would like to keep 1Gb free for new images.

I have followed this thread but cannot find the solution there.

autotrash would be a good command but I do not have gnome installed.

Does anybody have any suggestions?

1 Answers1

0

Your original question is "How to delete files and subdirectories by size and age". Use find:

This will delete all files under the current directory larger than 2 MB:

find ./ -size +2M -delete

This will delete all files created more than 7 days ago:

find ./ -ctime +7 -delete
roadmr
  • 34,802