Prev: [Samba] Forcing umask for "other users" , or remapping POSIX to ACL
Next: [Samba] limit access to folder without mapping a new drive
From: John Drescher on 29 Jun 2010 11:30 On Tue, Jun 29, 2010 at 10:55 AM, Leonardo Carneiro - Veltrac <lscarneiro(a)veltrac.com.br> wrote: > Hi Brian, tks for your answer. I'm confident that my goal could be achieved > through the use of some third-party tool, like a script or something like > it, like you sugested. But what i really need to know is if there is some > feature in samba that would allow me to do just that. > Samba does not have this builtin. John -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba
From: Mike Eggleston on 29 Jun 2010 11:30 On Tue, 29 Jun 2010, Leonardo Carneiro - Veltrac might have said: > 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. #!/usr/bin/perl # $Id$ # $Log$ # delete files that are 24 hours old use Getopt::Std; use strict; # globals my $dir = '/tmp'; my $oldest = time - 86400; # get the files opendir(DIR, $dir) or die "$0: cannot open dir '$dir': $!"; my @files = readdir(DIR); closedir(DIR) or die "$0: cannot close dir '$dir': $!"; # decide which files to delete my @deletefiles; foreach my $file (@files) { next if $file eq '.'; next if $file eq '..'; next if $file eq 'lost+found'; my @st = stat($dir . '/' . $file); push(@deletefiles, $file) if $st[9] < $oldest; } # delete the files map { unlink($dir . '/' . $_) or warn "$0: cannot remove file '$dir/$_': $!" } @deletefiles; -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba
From: Mike Eggleston on 29 Jun 2010 11:40
On Tue, 29 Jun 2010, Benedict White might have said: > You could write a bash script like this: > > #!/bin/bash > find /some/temp/dir/ -name "*" -atime 1 -delete Duh, you can also do it with mtime and not a time find $dir -mtime 1 -exec /bin/rm -f {} \; You don't have to give a name if you want all files. Mike -- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba |