Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
For starters, I'm a newbie in Linux. So, I've pretty much worked my way in creating a Linux server to use as an FTP server. Everything so far is functioning as it's suppose to.
I've set up quotas for users and groups. However, I would like to run a cron job to run a script that would go in and view files that are 45 days older than the system date. In which case, it would delete the files in everyones home directory that meet that criteria.
So, I thought I ask the experts and maybe you guys can help me create a script that would do just that.
Requirements:
if files are 45 days or older, delete for user's or groups directories.
Before I put this in place. I have another question. I several folders created under /home, however I just want the actual files within those directories to be removed. Can the command you provided me do it?
find = the command issued to start the search
/home = the directory and all subdirectories to search in
-type f = the types it will search specifically for, f stands for files so it will disregard directories
-mtime +45 = the age of the files it will look for
-exec rm-rf = once it finds all the files in /home and beyond that are older than 45 days, it will remove them.
Hope that helps you understand what david presented you with and possibly use. But I would take his suggestion in running that second command, to make sure it will find the files that are older than 45 days, etc, to be for sure to test.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.