Fix spurious check of unix home directory during session_setup when add user script...
[Samba.git] / examples / VFS / recycle / cleanup_recycle.pl
blobf614cf78708ed9c2c5fa6b637a5234424debedea
1 # !/usr/bin/perl -w
3 # this script looks for all files with an access date older than
4 # $maxage days and deletes them.
5 # Empty directories will be deleted afterwards
8 $dirpath = "/data/.recycle";
9 $maxage = 2;
11 # delete all old files
12 @a=`find $dirpath -atime +$maxage`;
13 foreach (@a)
15 print "deleting file: $_";
16 $r = `rm -f $_ 2> /dev/zero`;
19 # delete all empty directories
20 @a=`find $dirpath -type d | sort -r`;
21 foreach (@a)
23 print "deleting directory: $_";
24 $r = `rmdir $_ 2> /dev/zero`;