LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-26-2011, 10:20 AM   #1
panseluta
LQ Newbie
 
Registered: Dec 2008
Posts: 20

Rep: Reputation: 1
script to delete files older than X days fstab has noatime enabled


Hello there!

The story sounds like this: a public share with no restrictions, every user has it's own folder there and in time it becomes messy and very large in gigs.

I have set up a simple find and delete script for files older than X days.

The problem is that some of the files that are send in this share are transfered from an archive server and creation/modified date remains the same when copied and the age of them could be a year ago or older and they get deleted over night by the script.
For performance reasons the raid is mounted with noatime in fstab.

Do you see any solution to this problem except enabling atime?

I'm thinking at some more advanced script that writes the list of added files once a day and marks them for deletion after some time.

Thanks in advance
 
Old 07-26-2011, 04:01 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,781

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Test the ctime (inode change time) rather than relying on atime. The inode change time will always show the last time something about the file changed, and that includes creation, altering of content, number of links, permissions, ownership, ... .
 
Old 07-27-2011, 12:18 PM   #3
panseluta
LQ Newbie
 
Registered: Dec 2008
Posts: 20

Original Poster
Rep: Reputation: 1
Thank you!

ctime does the job
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
delete files when it's older 30 days Madison00 Linux - Newbie 8 01-07-2011 02:07 AM
[SOLVED] Delete old files older than 7 days anon091 Linux - Newbie 3 09-18-2009 01:15 PM
Automated script to DELETE files older than 2 days in a Particular folder siddhartha_ece2004 Linux - Newbie 14 07-11-2008 05:46 AM
Script help - delete files older than 45 days but exclude the system files jojothedogboy Linux - Software 3 06-13-2008 03:43 PM
script to auto delete files older than X days nocnoc Programming 17 12-06-2006 08:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration