[Samba] [OT?] $RECYCLE.BIN cleanup...

L.P.H. van Belle belle at bazuin.nl
Tue Dec 11 15:40:12 UTC 2018

Since there is a very low volume today. 

I've not tested/setup yet, so test this, but my idea here is this.

Step 1: 
Dont move files to recycle bin. 

Take note off this, with this setup im having every thing redirect to servers. 
Users dont use lokal disks. ( even the users desktop is on the server here )

Step 2: 
enable samba recycle bin and/or vfs_shadow_copy2 
Use these. 

Step 3: 
Use something like this on the server. 
find /home/users/*/Desktop/$RECYCLE/ -type f -name '*.jpg' -mtime +30 -exec rm {} \;
(delete every *.jpg file older then 30 days)

Dont use * but *.extention, or loop throug some extentions. 
If the list is to long with a wildcard, you will get "Argument list too long error." and it fails.
Or count the total files before you use a wildcard. 

For now, 



> -----Oorspronkelijk bericht-----
> Van: samba [mailto:samba-bounces at lists.samba.org] Namens 
> Marco Gaiarin via samba
> Verzonden: dinsdag 11 december 2018 14:53
> Aan: samba at lists.samba.org
> Onderwerp: [Samba] [OT?] $RECYCLE.BIN cleanup...
> I've noted that in my domain (AD) if i do some folder redirection in
> GPO, for every folder a $RECYCLE.BIN folder get created. That users
> clearly never cleanup.
> a) (Windows Side) there's some 'things' (GPO, script, ...) 
> that can cleanup trash
>  folders 'file older then X days'? I've found the powershell script
> 'Clear-RecycleBin', but seems that empty the bin, not 'older 
> then x'...
> b) (samba side) if simply i cleanup files 'server side' via a 
> 'find' script, can
>  have some troubles 'winows side'? Or windows is sufficient smart to
> regenerate the trash folder db?
> Thanks.
> -- 
> dott. Marco Gaiarin				        GNUPG 
> Key ID: 240A3D66
>   Associazione ``La Nostra Famiglia''          
> http://www.lanostrafamiglia.it/
>   Polo FVG   -   Via della Bontà, 7 - 33078   -   San Vito al 
> Tagliamento (PN)
>   marco.gaiarin(at)lanostrafamiglia.it   t +39-0434-842711   
> f +39-0434-842797
>       http://www.lanostrafamiglia.it/index.php/it/sostienici/5x1000
> 	(cf 00307430132, categoria ONLUS oppure RICERCA SANITARIA)
> -- 
> 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