[Samba] file "time-to-live"

Benedict White Benedict.White at cse-ltd.co.uk
Tue Jun 29 09:18:06 MDT 2010


You could write a bash script like this:

#!/bin/bash
find /some/temp/dir/ -name "*" -atime 1 -delete

Where atime* indictates file was modified 1 * 24 hours ago.

(*There are loads of time based operators for find)

See http://unixhelp.ed.ac.uk/CGI/man-cgi?find for the find man page.

You may also want to use -P to never follow symbolic links.

Then once the batch file is created, chmod it to something like 750, and make it a cron job to run every hour.

Kind Regards,
Benedict White

Tel:
01444 238070
Tech:
01444 238080
Fax:
01444 238099
Web:
http://www.cse-ltd.co.uk
Registered in England and Wales No: 3066242
27 Victoria Gardens, Burgess Hill, West Sussex, RH15 9NB



Legal Disclaimer: This message and any attachment may be confidential and privileged. If you are not the intended recipient please notify the sender and delete this e-mail and any attachment from your system. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. All information given in this e-mail is provided in good faith but not binding for legal reasons.



-----Original Message-----
From: samba-bounces at lists.samba.org [mailto:samba-bounces at lists.samba.org] On Behalf Of Leonardo Carneiro - Veltrac
Sent: 29 June 2010 15:33
To: samba at lists.samba.org
Subject: [Samba] file "time-to-live"

Hi everyone,

There is a way to make files being automatically deleted some time after
they have been created?
I know that, with some scripting wizardry i could achieve this, but i
wanna know if samba has this kind of feature.

I have a temp folder that users insist in use like a backup folder, so i
want to files to be deleted 24 hours after they have been created.

I cannot just delete everything at midnight because this folder is used
in full time, so if a user create a file at 23h59, it would be deleted a
minute later.

Sorry for my poor english and tks in advance.
--
Leonardo Carneiro
--
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba


More information about the samba mailing list